mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 14:27:30 +00:00
Feat: Navigate to select org
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
import { NextRouter } from "next/router";
|
import { NextRouter } from "next/router";
|
||||||
|
|
||||||
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
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) => {
|
export const navigateUserToOrg = async (router: NextRouter, organizationId?: string) => {
|
||||||
const userOrgs = await fetchOrganizations();
|
const userOrgs = await fetchOrganizations();
|
||||||
|
|
||||||
const nonAuthEnforcedOrgs = userOrgs.filter((org) => !org.authEnforced);
|
const nonAuthEnforcedOrgs = userOrgs.filter((org) => !org.authEnforced);
|
||||||
|
|
||||||
if (organizationId) {
|
if (organizationId) {
|
||||||
@@ -24,3 +26,8 @@ export const navigateUserToOrg = async (router: NextRouter, organizationId?: str
|
|||||||
router.push("/org/none");
|
router.push("/org/none");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const navigateUserToSelectOrg = (router: NextRouter) => {
|
||||||
|
queryClient.invalidateQueries(userKeys.getUser);
|
||||||
|
router.push("/login/select-organization", undefined, { shallow: true });
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user