fix(freight-portal): add /callback route for Fayda redirects

This commit is contained in:
ghost2023
2026-08-04 17:37:41 +03:00
parent 7393034188
commit f75b681a0e
3 changed files with 16 additions and 2 deletions

View File

@@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port 5173 --clearScreen false",
"dev": "vite --port 3000 --clearScreen false",
"build": "tsc -b && vite build",
"preview": "vite preview --port 5173",
"lint": "eslint src",

View File

@@ -267,6 +267,7 @@ const App = () => {
to the page that started it. Public on purpose: behind RequireAuth
the onboarding gate would redirect away before the exchange ran. */}
<Route path="/fayda/callback" element={<FaydaCallbackPage />} />
<Route path="/callback" element={<FaydaCallbackPage />} />
<Route path="/payment/success" element={<PaymentSuccessPage />} />
<Route path="/payment/failure" element={<PaymentFailurePage />} />

View File

@@ -209,7 +209,20 @@ export default function OnboardingWizardDialog({
nationality?: CompanyNationality;
}) => api.companies.startOnboarding.call(vars),
onSuccess: async () => {
await refreshInfo();
// Nationality drives the server-resolved identity requirements (Fayda vs
// passport), the document set and the GM/PoA copy — all read from
// onboardingRequirements/profile. Re-entering role selection can change
// it, so both must be refetched alongside getInfo or the form step would
// keep rendering the previous nationality's requirements.
await Promise.all([
refreshInfo(),
queryClient.invalidateQueries({
queryKey: api.companies.onboardingRequirements.queryKey(),
}),
queryClient.invalidateQueries({
queryKey: api.companies.getProfile.queryKey(),
}),
]);
setPhase("form");
},
onError: (err) => setStartError(extractApiError(err).message),