fix: projects fetching

This commit is contained in:
Piyush Gupta
2025-11-24 19:42:42 +05:30
parent 1f2a764d3e
commit acb0207c83
@@ -197,7 +197,6 @@ export const Navbar = () => {
const handleOrgChange = async (orgId: string) => { const handleOrgChange = async (orgId: string) => {
queryClient.removeQueries({ queryKey: authKeys.getAuthToken }); queryClient.removeQueries({ queryKey: authKeys.getAuthToken });
queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
const { token, isMfaEnabled, mfaMethod } = await selectOrganization({ const { token, isMfaEnabled, mfaMethod } = await selectOrganization({
organizationId: orgId organizationId: orgId
@@ -212,6 +211,11 @@ export const Navbar = () => {
setMfaSuccessCallback(() => () => handleOrgChange(orgId)); setMfaSuccessCallback(() => () => handleOrgChange(orgId));
return; return;
} }
SecurityClient.setToken(token);
SecurityClient.setProviderAuthToken("");
queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
await router.invalidate(); await router.invalidate();
await navigateUserToOrg(navigate, orgId); await navigateUserToOrg(navigate, orgId);
queryClient.removeQueries({ queryKey: subOrgQuery.queryKey }); queryClient.removeQueries({ queryKey: subOrgQuery.queryKey });
@@ -219,7 +223,6 @@ export const Navbar = () => {
const handleSubOrgChange = async (subOrgId: string) => { const handleSubOrgChange = async (subOrgId: string) => {
queryClient.removeQueries({ queryKey: authKeys.getAuthToken }); queryClient.removeQueries({ queryKey: authKeys.getAuthToken });
queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
const { token, isMfaEnabled, mfaMethod } = await selectSubOrganization({ const { token, isMfaEnabled, mfaMethod } = await selectSubOrganization({
subOrganizationId: subOrgId subOrganizationId: subOrgId
@@ -235,6 +238,10 @@ export const Navbar = () => {
return; return;
} }
SecurityClient.setToken(token);
SecurityClient.setProviderAuthToken("");
queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
await router.invalidate(); await router.invalidate();
navigate({ navigate({
to: "/organizations/$orgId/projects", to: "/organizations/$orgId/projects",
@@ -630,7 +637,6 @@ export const Navbar = () => {
<DropdownMenu modal={false}> <DropdownMenu modal={false}>
<DropdownMenuTrigger> <DropdownMenuTrigger>
<div className="rounded-l-md border border-r-0 border-mineshaft-500 px-2.5 py-1 hover:bg-mineshaft-600"> <div className="rounded-l-md border border-r-0 border-mineshaft-500 px-2.5 py-1 hover:bg-mineshaft-600">
aple
<FontAwesomeIcon icon={faCircleQuestion} className="text-mineshaft-200" /> <FontAwesomeIcon icon={faCircleQuestion} className="text-mineshaft-200" />
</div> </div>
</DropdownMenuTrigger> </DropdownMenuTrigger>