Skip to content

Commit d22b911

Browse files
committed
feat: Remove unused idToken and email
1 parent b20b44a commit d22b911

4 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/features/auth/components/AuthModal.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AuthProvider, OAuthProvider, signInWithPopup } from 'firebase/auth'
1+
import { AuthProvider, signInWithPopup } from 'firebase/auth'
22
import { FaGithub } from 'react-icons/fa'
33
import { FcGoogle } from 'react-icons/fc'
44
import { IoHeartCircle } from 'react-icons/io5'
@@ -19,19 +19,14 @@ export const AuthModal = ({ showAuth }: AuthModalProps) => {
1919
const signIn = (provider: AuthProvider) => {
2020
signInWithPopup(firebaseAuth, provider)
2121
.then((result) => {
22-
const credential = OAuthProvider.credentialFromResult(result)
23-
const idToken = credential?.idToken
24-
const email = result.user.displayName
2522
const name = result.user.displayName
2623
const imageURL = result.user.photoURL
27-
if (idToken && name && email && imageURL) {
24+
if (name && imageURL) {
2825
trackUserConnect(provider.providerId)
2926
closeAuthModal()
3027
initState({
31-
idToken: idToken,
3228
user: {
3329
name: name,
34-
email: email,
3530
imageURL: imageURL,
3631
},
3732
})

src/features/auth/hooks/useAuth.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { trackUserDisconnect } from 'src/lib/analytics'
44
export const useAuth = () => {
55
const { isAuthModalOpen, openAuthModal, closeAuthModal } = AuthModalStore()
66
const authStore = AuthStore()
7-
const { idToken, user, initState, clear } = authStore
7+
const { user, initState, clear } = authStore
88

99
const isConnected = () => user != null
1010

@@ -20,7 +20,6 @@ export const useAuth = () => {
2020
isConnected,
2121
logout,
2222
isAuthModalOpen,
23-
idToken,
2423
user,
2524
}
2625
}

src/features/auth/stores/authStore.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { create } from 'zustand'
33
import { persist } from 'zustand/middleware'
44

55
type AuthState = {
6-
idToken: string | null
76
user: User | null
87
}
98

@@ -19,7 +18,6 @@ export const AuthStore = create(
1918
user: null,
2019
initState: (newState: AuthState) =>
2120
set({
22-
idToken: newState.idToken,
2321
user: newState.user,
2422
}),
2523
clear: () => set({ user: null }),

src/features/auth/types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export type User = {
22
name: string
3-
email: string
43
imageURL?: string
54
}

0 commit comments

Comments
 (0)