feat: implement cover image upload with canvas compression and db storage in RIT-EMS-main

This commit is contained in:
2026-06-19 09:37:29 +05:30
parent 91842646f0
commit 785fe05902
17 changed files with 1217 additions and 453 deletions

View File

@@ -5,7 +5,9 @@ import {
createUserWithEmailAndPassword,
signOut,
onAuthStateChanged,
getUser
getUser,
GoogleAuthProvider,
signInWithPopup
} from 'firebase/auth';
import {
getFirestore,
@@ -318,6 +320,27 @@ class FirestoreQueryBuilder {
// Map supabase.auth
const supabaseAuth = {
async signInWithOAuth({ provider }: { provider: string }) {
if (provider !== 'google') {
return { data: { provider: null }, error: new Error("Unsupported OAuth provider") };
}
try {
const googleProvider = new GoogleAuthProvider();
const credential = await signInWithPopup(auth, googleProvider);
const user = {
id: credential.user.uid,
email: credential.user.email,
user_metadata: {
name: credential.user.displayName
}
};
return { data: { user }, error: null };
} catch (error: any) {
console.error("Firebase Google Auth Signin Error:", error);
return { data: { user: null }, error };
}
},
async signInWithPassword({ email, password }: any) {
try {
const credential = await signInWithEmailAndPassword(auth, email, password);