Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparowhawk committed Dec 12, 2024
1 parent a13df1c commit a6ea1f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions VAMobile/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
useBiometricsSettings,
useHandleTokenCallbackUrl,
useLogout,
usePostLoggedIn,
useRefreshAccessToken,
} from 'api/auth'
import queryClient from 'api/queryClient'
Expand Down Expand Up @@ -212,7 +211,6 @@ export function AuthGuard() {
const { mutate: logout } = useLogout()
const { mutate: refreshAccessToken } = useRefreshAccessToken()
const { mutate: handleTokenCallbackUrl } = useHandleTokenCallbackUrl()
const { mutate: postLoggedIn } = usePostLoggedIn()
setlogout(logout)
setRefreshAccessToken(refreshAccessToken)
setFileSystemRefreshAccessToken(refreshAccessToken)
Expand Down Expand Up @@ -311,9 +309,9 @@ export function AuthGuard() {
useEffect(() => {
console.debug('AuthGuard: initializing')
if (!loggedIn) {
initializeAuth(dispatch, refreshAccessToken, postLoggedIn)
initializeAuth(dispatch, refreshAccessToken)
}
}, [loggedIn, refreshAccessToken, dispatch, postLoggedIn])
}, [loggedIn, refreshAccessToken, dispatch])

useEffect(() => {
if (!loggedIn) {
Expand Down
5 changes: 1 addition & 4 deletions VAMobile/src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { dispatchUpdateLoading, dispatchUpdateLoggedIn, dispatchUpdateSyncing }
import getEnv from 'utils/env'

import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from './analytics'
import { isErrorObject } from './common'
import { pkceAuthorizeParams } from './oauth'
import { isAndroid } from './platform'

Expand Down Expand Up @@ -339,15 +338,14 @@ export const processAuthResponse = async (response: Response): Promise<AuthCrede
export const initializeAuth = async (
dispatch: AppDispatch,
refreshAccessToken: (variables: string, options?: MutateOptions<Response, Error, string, void> | undefined) => void,
postLoggedIn: () => void,
) => {
if (store.getState().demo.demoMode) {
return
}
const pType = await getAuthLoginPromptType()
if (pType === LOGIN_PROMPT_TYPE.UNLOCK) {
await finishInitialize(dispatch, false)
await startBiometricsLogin(dispatch, refreshAccessToken, postLoggedIn)
await startBiometricsLogin(dispatch, refreshAccessToken)
return
} else {
const refreshToken = api.getRefreshToken() || (await retrieveRefreshToken())
Expand All @@ -363,7 +361,6 @@ export const initializeAuth = async (
const startBiometricsLogin = async (
dispatch: AppDispatch,
refreshAccessToken: (variables: string, options?: MutateOptions<Response, Error, string, void> | undefined) => void,
postLoggedIn: () => void,
) => {
const loading = store.getState().auth.loading
if (loading) {
Expand Down

0 comments on commit a6ea1f7

Please sign in to comment.