From 7fd6b63b5d5c8241219320bc948798f7dbcc7817 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Sat, 9 Mar 2024 09:04:34 +0100 Subject: [PATCH] Feat: Navigate to select org --- frontend/src/views/Login/Login.utils.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Login/Login.utils.tsx b/frontend/src/views/Login/Login.utils.tsx index 0aa063268..4615d8f27 100644 --- a/frontend/src/views/Login/Login.utils.tsx +++ b/frontend/src/views/Login/Login.utils.tsx @@ -1,10 +1,12 @@ import { NextRouter } from "next/router"; import { fetchOrganizations } from "@app/hooks/api/organization/queries"; +import { userKeys } from "@app/hooks/api/users/queries"; +import { queryClient } from "@app/reactQuery"; export const navigateUserToOrg = async (router: NextRouter, organizationId?: string) => { const userOrgs = await fetchOrganizations(); - + const nonAuthEnforcedOrgs = userOrgs.filter((org) => !org.authEnforced); if (organizationId) { @@ -24,3 +26,8 @@ export const navigateUserToOrg = async (router: NextRouter, organizationId?: str router.push("/org/none"); } }; + +export const navigateUserToSelectOrg = (router: NextRouter) => { + queryClient.invalidateQueries(userKeys.getUser); + router.push("/login/select-organization", undefined, { shallow: true }); +};