feat: remove OTP gate from transactions, fix categories auth, add implementation plan
- Remove OtpGateGuard from transactions controller (OTP verified at login) - Fix categories controller to use authenticated user instead of TEMP_USER_ID - Add comprehensive implementation plan document - Update .env.example with WEB_APP_URL - Prepare for admin dashboard development
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
import { initializeApp } from 'firebase/app';
|
||||
import { getAuth, GoogleAuthProvider } from 'firebase/auth';
|
||||
|
||||
// Validate required environment variables
|
||||
const requiredEnvVars = [
|
||||
'VITE_FIREBASE_API_KEY',
|
||||
'VITE_FIREBASE_AUTH_DOMAIN',
|
||||
'VITE_FIREBASE_PROJECT_ID',
|
||||
'VITE_FIREBASE_STORAGE_BUCKET',
|
||||
'VITE_FIREBASE_MESSAGING_SENDER_ID',
|
||||
'VITE_FIREBASE_APP_ID'
|
||||
];
|
||||
|
||||
const missingVars = requiredEnvVars.filter(varName => !import.meta.env[varName]);
|
||||
|
||||
if (missingVars.length > 0) {
|
||||
console.error('❌ Missing Firebase environment variables:', missingVars);
|
||||
console.error('Please check your .env.local file and ensure all Firebase config variables are set.');
|
||||
console.error('See .env.example for the required variables.');
|
||||
}
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
|
||||
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
|
||||
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
|
||||
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
|
||||
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
|
||||
appId: import.meta.env.VITE_FIREBASE_APP_ID,
|
||||
};
|
||||
|
||||
// Initialize Firebase
|
||||
const app = initializeApp(firebaseConfig);
|
||||
|
||||
// Initialize Firebase Authentication and get a reference to the service
|
||||
export const auth = getAuth(app);
|
||||
|
||||
// Initialize Google Auth Provider with additional configuration
|
||||
export const googleProvider = new GoogleAuthProvider();
|
||||
|
||||
// Configure Google provider for better UX
|
||||
googleProvider.setCustomParameters({
|
||||
prompt: 'select_account', // Always show account selection
|
||||
});
|
||||
|
||||
// Add additional scopes if needed
|
||||
googleProvider.addScope('email');
|
||||
googleProvider.addScope('profile');
|
||||
|
||||
export default app;
|
||||
@@ -4,3 +4,21 @@ import { twMerge } from "tailwind-merge"
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3001'
|
||||
|
||||
export function getAvatarUrl(avatarUrl: string | null | undefined): string | null {
|
||||
if (!avatarUrl) return null
|
||||
|
||||
// If it's already a full URL (starts with http), return as is
|
||||
if (avatarUrl.startsWith('http://') || avatarUrl.startsWith('https://')) {
|
||||
return avatarUrl
|
||||
}
|
||||
|
||||
// If it's a relative path (starts with /), prepend API URL
|
||||
if (avatarUrl.startsWith('/')) {
|
||||
return `${API_URL}${avatarUrl}`
|
||||
}
|
||||
|
||||
return avatarUrl
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user