Fix: 2FA/passkey page redirect + org Setup context

This commit is contained in:
2026-03-06 09:39:55 +05:45
parent 979b5a918e
commit 77e3a1fcec
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -8,6 +8,7 @@
*/
import { useState, useEffect } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import { useQueryClient } from "@tanstack/react-query";
import { Building2, Plus, ArrowRight, Loader2, Mail, ChevronDown, ChevronUp } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -33,6 +34,7 @@ interface LocationState {
export default function OrgSetupPage() {
const navigate = useNavigate();
const location = useLocation();
const queryClient = useQueryClient();
const { refreshUser, checkOrgAdmin, isOrgMember, isLoading } = useAuth();
// If the user already belongs to an org (e.g. they bookmarked /org-setup),
@@ -100,6 +102,7 @@ export default function OrgSetupPage() {
const done = async () => {
await refreshUser();
await checkOrgAdmin();
queryClient.invalidateQueries({ queryKey: ['organizations'] });
navigate("/profile", { replace: true });
};