diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx index d0f38b089..e9d603169 100644 --- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx +++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx @@ -197,7 +197,6 @@ export const Navbar = () => { const handleOrgChange = async (orgId: string) => { queryClient.removeQueries({ queryKey: authKeys.getAuthToken }); - queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() }); const { token, isMfaEnabled, mfaMethod } = await selectOrganization({ organizationId: orgId @@ -212,6 +211,11 @@ export const Navbar = () => { setMfaSuccessCallback(() => () => handleOrgChange(orgId)); return; } + + SecurityClient.setToken(token); + SecurityClient.setProviderAuthToken(""); + queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() }); + await router.invalidate(); await navigateUserToOrg(navigate, orgId); queryClient.removeQueries({ queryKey: subOrgQuery.queryKey }); @@ -219,7 +223,6 @@ export const Navbar = () => { const handleSubOrgChange = async (subOrgId: string) => { queryClient.removeQueries({ queryKey: authKeys.getAuthToken }); - queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() }); const { token, isMfaEnabled, mfaMethod } = await selectSubOrganization({ subOrganizationId: subOrgId @@ -235,6 +238,10 @@ export const Navbar = () => { return; } + SecurityClient.setToken(token); + SecurityClient.setProviderAuthToken(""); + + queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() }); await router.invalidate(); navigate({ to: "/organizations/$orgId/projects", @@ -630,7 +637,6 @@ export const Navbar = () => {
- aple