fix: page refresh problem #297

This commit is contained in:
shuai 2023-04-04 14:32:53 +08:00
parent 7b55f28993
commit adbb57816a
3 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import { usePageTags } from '@/hooks';
import { loggedUserInfoStore, siteInfoStore } from '@/stores';
import { changeEmailVerify, getLoggedUserInfo } from '@/services';
import { changeEmailVerify } from '@/services';
const Index: FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'account_result' });
@ -20,12 +20,12 @@ const Index: FC = () => {
if (code) {
// do
changeEmailVerify({ code })
.then(() => {
.then((res) => {
setStep('success');
getLoggedUserInfo().then((res) => {
if (res?.access_token) {
// update user info
updateUser(res);
});
}
})
.catch(() => {
setStep('invalid');

View File

@ -32,7 +32,7 @@ const initUser: UserInfoRes = {
const loggedUserInfoStore = create<UserInfoStore>((set) => ({
user: initUser,
update: (params) => {
if (!params.language) {
if (!params?.language) {
params.language = 'Default';
}
set(() => {

View File

@ -14,6 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noImplicitAny": false,
"ignoreDeprecations": "5.0",
"suppressImplicitAnyIndexErrors": true,
"noEmit": true,
"jsx": "react-jsx",