fix(setup): Apply language choice and fix post-setup redirect
- Call changeLanguage(values.language) after successful owner creation so the UI immediately switches to the language the owner chose - Call _markSystemInitialized() to update the router cache before navigating to /login; without this the guard saw initialized=false and redirected back to /setup, blocking the redirect Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import { FormErrorBanner } from '@/components/ui/FormErrorBanner';
|
||||
import { FieldError } from '@/components/ui/FieldError';
|
||||
import { useSetup } from '@/api/useSetup';
|
||||
import { ProblemDetailsError, NetworkError } from '@/lib/api-client';
|
||||
import { changeLanguage } from '@/i18n/config';
|
||||
import { _markSystemInitialized } from '@/router';
|
||||
|
||||
interface FormError {
|
||||
message: string;
|
||||
@@ -47,6 +49,8 @@ export function SetupPage() {
|
||||
try {
|
||||
const { confirmPassword: _, ...payload } = values;
|
||||
await setupMutation.mutateAsync(payload);
|
||||
await changeLanguage(values.language);
|
||||
_markSystemInitialized();
|
||||
setSuccessMessage(true);
|
||||
setTimeout(() => {
|
||||
navigate({ to: '/login' });
|
||||
|
||||
@@ -50,6 +50,11 @@ export function _resetSetupStatusCache(): void {
|
||||
_setupStatusPromise = null;
|
||||
}
|
||||
|
||||
export function _markSystemInitialized(): void {
|
||||
_setupStatusCache = { initialized: true };
|
||||
_setupStatusPromise = null;
|
||||
}
|
||||
|
||||
function RouteFallback() {
|
||||
return (
|
||||
<div className="flex min-h-40 items-center justify-center text-muted-foreground">
|
||||
|
||||
Reference in New Issue
Block a user