Skip to content

Commit

Permalink
refactor: auth status settled value (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Nov 4, 2024
1 parent 3024379 commit 2199c17
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/hooks/authentication/session/useSessionActive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useSessionActive = (authState: AuthState): void => {
const { status } = authState;
const { callbackUrl } = useRouteHistory(2);
useEffect(() => {
if (status !== AUTH_STATUS.DONE) return;
if (status !== AUTH_STATUS.SETTLED) return;
Router.push(callbackUrl(transformRoute));
}, [callbackUrl, status]);
};
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/authentication/session/useSessionAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getSession(
switch (status) {
case AUTH_STATUS.PENDING:
return { isAuthenticated: false, status };
case AUTH_STATUS.DONE:
case AUTH_STATUS.SETTLED:
return { isAuthenticated, status };
default:
return { isAuthenticated: false, status };
Expand All @@ -57,5 +57,5 @@ function getSession(
*/
function getSessionStatus(status: AUTHENTICATION_STATUS): AUTH_STATUS {
if (status === AUTHENTICATION_STATUS.PENDING) return AUTH_STATUS.PENDING;
return AUTH_STATUS.DONE;
return AUTH_STATUS.SETTLED;
}
2 changes: 1 addition & 1 deletion src/providers/authentication/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface Service {
}

export enum AUTH_STATUS {
DONE = "DONE",
PENDING = "PENDING",
SETTLED = "SETTLED",
}

export interface UpdateAuthStateAction {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/googleSignInAuthentication/contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

export const AUTH_STATE: AuthState = {
...DEFAULT_AUTH_STATE,
status: AUTH_STATUS.DONE,
status: AUTH_STATUS.SETTLED,
};

export const AUTHENTICATION_STATE: AuthenticationState = {
Expand Down

0 comments on commit 2199c17

Please sign in to comment.