feat: implement cover image upload with canvas compression and db storage in RIT-EMS-main
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user