From 1874541dea524d4c4894e0212c54d843a77fc742 Mon Sep 17 00:00:00 2001 From: Helena Standaert Date: Fri, 9 Feb 2024 14:59:34 +0100 Subject: [PATCH 1/2] UIT-240: Fix errorMessage tracking with up-action --- src/scan/familyCheckin/FamilyCheckin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scan/familyCheckin/FamilyCheckin.tsx b/src/scan/familyCheckin/FamilyCheckin.tsx index 75dce41e..291c9dcf 100644 --- a/src/scan/familyCheckin/FamilyCheckin.tsx +++ b/src/scan/familyCheckin/FamilyCheckin.tsx @@ -74,7 +74,7 @@ const FamilyCheckin: FC = ({ navigation, route }: TProps) => { { up_action: { ...sharedAction, - points: null, + points: 0, }, }, ); From 80c00801d4991e3c27fabeb7f5768c94fb8f4ed6 Mon Sep 17 00:00:00 2001 From: Helena Standaert Date: Mon, 12 Feb 2024 11:38:02 +0100 Subject: [PATCH 2/2] UIT-240: Clear authentication state when logging out --- src/_context/AuthenticationContext.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/_context/AuthenticationContext.tsx b/src/_context/AuthenticationContext.tsx index de3cf338..86e63e22 100644 --- a/src/_context/AuthenticationContext.tsx +++ b/src/_context/AuthenticationContext.tsx @@ -35,15 +35,6 @@ const AuthenticationProvider: FC = ({ children }) => { const [isInitialized, setIsInitialized] = useToggle(false); const [isAuthenticated, setIsAuthenticated] = useToggle(false); - useEffect(() => { - if (!isAuthenticated) { - const queryCache = new QueryCache({}); - queryClient.clear(); - queryCache.clear(); - queryClient.removeQueries(); - } - }, [isAuthenticated]); - const client = useMemo( () => new Auth0({ @@ -56,6 +47,16 @@ const AuthenticationProvider: FC = ({ children }) => { const logout = useCallback(async () => { try { await client.credentialsManager.clearCredentials(); + + // Clear react query cache + const queryCache = new QueryCache({}); + queryClient.clear(); + queryCache.clear(); + queryClient.removeQueries(); + + // Reset state + setAccessToken(undefined); + setUser(undefined); setIsAuthenticated(false); } catch (e) { log.error(e);