Skip to content

Commit 3e8b93c

Browse files
committed
fix(platform): fix navigate to login when login
1 parent 51a331a commit 3e8b93c

File tree

1 file changed

+3
-1
lines changed
  • packages/platform/src/app/routes/login

1 file changed

+3
-1
lines changed

packages/platform/src/app/routes/login/Login.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { PREV_ROUTE_KEY } from '../../config/other';
22
import type { UserState } from '../../core/state';
33

4+
import { isString } from 'lodash';
45
import { useEffect, useState } from 'react';
56
import { useTranslation } from 'react-i18next';
67
import { useLocation, useNavigate } from 'react-router-dom';
@@ -11,6 +12,7 @@ import { DButton, DCheckbox, DForm, DInput, DTabs, FormControl, FormGroup, useFo
1112
import { getClassName } from '@react-devui/utils';
1213

1314
import { AppLanguage } from '../../components';
15+
import { LOGIN_PATH } from '../../config/other';
1416
import { APP_NAME } from '../../config/other';
1517
import { TOKEN, useHttp, useInit } from '../../core';
1618
import { NotificationService } from '../../utils';
@@ -72,7 +74,7 @@ export default function Login(): JSX.Element | null {
7274
setLoginLoading(false);
7375
TOKEN.set(res.token);
7476
init(res.user);
75-
navigate(from ?? '/', { replace: true });
77+
navigate(isString(from) && from !== LOGIN_PATH ? from : '/', { replace: true });
7678
},
7779
error: (error) => {
7880
setLoginLoading(false);

0 commit comments

Comments
 (0)