diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index 1cff329c..35266282 100644 --- a/web/lib/firebase/init.ts +++ b/web/lib/firebase/init.ts @@ -7,7 +7,7 @@ const firebaseConfig = { storageBucket: 'mantic-markets.appspot.com', messagingSenderId: '128925704902', appId: '1:128925704902:web:f61f86944d8ffa2a642dc7', - measurementId: '${config.measurementId}', + measurementId: 'G-SSFK1Q138D', } // Initialize Firebase diff --git a/web/lib/firebase/users.ts b/web/lib/firebase/users.ts index 1282d40c..fde517b0 100644 --- a/web/lib/firebase/users.ts +++ b/web/lib/firebase/users.ts @@ -32,14 +32,14 @@ export async function setUser(userId: string, user: User) { } const CACHED_USER_KEY = 'CACHED_USER_KEY' -export function listenForLogin(onUser: (user: User) => void) { +export function listenForLogin(onUser: (_user: User) => void) { // Immediately load any persisted user object from browser cache. const cachedUser = localStorage.getItem(CACHED_USER_KEY) if (cachedUser) { onUser(JSON.parse(cachedUser)) } - onAuthStateChanged(auth, async (user) => { + return onAuthStateChanged(auth, async (user) => { if (user) { let fetchedUser = await getUser(user.uid) if (!fetchedUser) { @@ -65,6 +65,7 @@ export function listenForLogin(onUser: (user: User) => void) { } else { // User logged out; reset to the empty object onUser({} as User) + localStorage.removeItem(CACHED_USER_KEY) } }) } @@ -76,7 +77,6 @@ export async function firebaseLogin() { export async function firebaseLogout() { auth.signOut() - localStorage.removeItem(CACHED_USER_KEY) } const storage = getStorage(app) diff --git a/web/package.json b/web/package.json index 6283a5f2..e9b33044 100644 --- a/web/package.json +++ b/web/package.json @@ -11,12 +11,12 @@ "dependencies": { "@headlessui/react": "1.4.2", "@heroicons/react": "1.0.5", - "chart.js": "^3.6.1", - "daisyui": "^1.16.2", - "firebase": "^9.6.0", + "chart.js": "3.6.1", + "daisyui": "1.16.2", + "firebase": "9.6.0", "next": "12.0.4", "react": "17.0.2", - "react-chartjs-2": "^4.0.0", + "react-chartjs-2": "4.0.0", "react-dom": "17.0.2" }, "devDependencies": {