Feat: Navigate to select org

This commit is contained in:
Daniel Hougaard
2024-03-17 18:48:10 +01:00
parent 995777d76f
commit 7fd6b63b5d
+7
View File
@@ -1,6 +1,8 @@
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();
@@ -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 });
};