diff --git a/VAMobile/src/constants/analytics.ts b/VAMobile/src/constants/analytics.ts index cb27c4e5f46..df88808b8f6 100644 --- a/VAMobile/src/constants/analytics.ts +++ b/VAMobile/src/constants/analytics.ts @@ -567,11 +567,6 @@ export const Events = { }, } }, - vama_exchange_failed: (): Event => { - return { - name: 'vama_exchange_failed', - } - }, vama_fail: (): Event => { return { name: 'vama_fail', @@ -745,11 +740,11 @@ export const Events = { }, } }, - vama_login_token_fetch: (status_code: number): Event => { + vama_login_token_fetch: (error: Error): Event => { return { name: 'vama_login_token_fetch', params: { - status_code, + error: JSON.stringify(error), }, } }, @@ -761,11 +756,11 @@ export const Events = { }, } }, - vama_login_token_refresh: (status_code: number): Event => { + vama_login_token_refresh: (error: Error): Event => { return { name: 'vama_login_token_refresh', params: { - status_code, + error: JSON.stringify(error), }, } }, diff --git a/VAMobile/src/store/slices/authSlice.ts b/VAMobile/src/store/slices/authSlice.ts index 064048e2704..c3f83f2fae3 100644 --- a/VAMobile/src/store/slices/authSlice.ts +++ b/VAMobile/src/store/slices/authSlice.ts @@ -494,16 +494,13 @@ export const attemptIntializeAuthWithRefreshToken = async ( if (isErrorObject(error)) { console.error(error) logNonFatalErrorToFirebase(error, `attemptIntializeAuthWithRefreshToken: ${authNonFatalErrorString}`) - if (error.status) { - await logAnalyticsEvent(Events.vama_login_token_refresh(error.status)) - } + await logAnalyticsEvent(Events.vama_login_token_refresh(error)) } // if some error occurs, we need to force them to re-login // even if they had a refreshToken saved, since these tokens are one time use // if we fail, we just need to get a new one (re-login) and start over // TODO we can check to see if we get a specific error for this scenario (refresh token no longer valid) so we may avoid // re-login in certain error situations - // await logAnalyticsEvent(Events.vama_exchange_failed()) await finishInitialize(dispatch, LOGIN_PROMPT_TYPE.LOGIN, false) } } @@ -682,10 +679,8 @@ export const handleTokenCallbackUrl = } catch (error) { if (isErrorObject(error)) { logNonFatalErrorToFirebase(error, `handleTokenCallbackUrl: ${authNonFatalErrorString}`) - await logAnalyticsEvent(Events.vama_exchange_failed()) - if (error.status) { - await logAnalyticsEvent(Events.vama_login_token_fetch(error.status)) - } + await logAnalyticsEvent(Events.vama_login_token_fetch(error)) + dispatch(dispatchFinishAuthLogin({ error })) } }