fix: fail to switch language

This commit is contained in:
gaoxiao6331
2025-02-23 22:21:17 +08:00
committed by dashuai
parent aabce8735e
commit c239d87390
+9
View File
@@ -22,6 +22,8 @@ import { Container, Row, Col, Card, Alert } from 'react-bootstrap';
import { useTranslation, Trans } from 'react-i18next';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { useStore } from 'zustand';
import type { FormDataType } from '@/common/interface';
import {
dbCheck,
@@ -38,6 +40,7 @@ import {
import { CURRENT_LANG_STORAGE_KEY } from '@/common/constants';
import { BASE_ORIGIN } from '@/router/alias';
import { setupInstallLanguage } from '@/utils/localize';
import { loggedUserInfoStore } from '@/stores';
import {
FirstStep,
@@ -137,6 +140,8 @@ const Index: FC = () => {
},
});
const { update, user } = useStore(loggedUserInfoStore);
const updateFormData = (params: FormDataType) => {
if (Object.keys(params)?.[0] === 'db_type') {
let updatedFormData = formData;
@@ -248,6 +253,10 @@ const Index: FC = () => {
const handleStep = () => {
if (step === 1) {
Storage.set(CURRENT_LANG_STORAGE_KEY, formData.lang.value);
update({
...user,
language: formData.lang.value,
});
handleNext();
}
if (step === 2) {