Download src/services/auth_service.js from UnDaoDu/aimindmap: direct link, hf CLI and curl.
- Browser
- Download file 720 Bytes
-
https://huggingface.co/spaces/UnDaoDu/aimindmap/resolve/main/src/services/auth_service.js
- Command line
-
hf download hf://spaces/UnDaoDu/aimindmap/src/services/auth_service.js
-
curl -L -o auth_service.js https://huggingface.co/spaces/UnDaoDu/aimindmap/resolve/main/src/services/auth_service.js
720 Bytes
| import { signInWithPopup, signOut } from 'firebase/auth'; | |
| import { auth, googleProvider } from './firebase'; | |
| class AuthService { | |
| async signInWithGoogle() { | |
| try { | |
| const result = await signInWithPopup(auth, googleProvider); | |
| return result.user; | |
| } catch (error) { | |
| console.error('Error signing in with Google:', error); | |
| throw error; | |
| } | |
| } | |
| async signOut() { | |
| try { | |
| await signOut(auth); | |
| } catch (error) { | |
| console.error('Error signing out:', error); | |
| throw error; | |
| } | |
| } | |
| getCurrentUser() { | |
| return auth.currentUser; | |
| } | |
| onAuthStateChanged(callback) { | |
| return auth.onAuthStateChanged(callback); | |
| } | |
| } | |
| export const authService = new AuthService(); |