fix: default enter page for user

This commit is contained in:
jialin
2025-11-10 20:40:15 +08:00
parent 9eb1dba4a1
commit b4b25d4300
12 changed files with 48 additions and 39 deletions
+2 -1
View File
@@ -20,6 +20,7 @@ import { Avatar, Divider, Modal } from 'antd';
import { useAtom } from 'jotai';
import { useMemo } from 'react';
import styled from 'styled-components';
import { DEFAULT_ENTER_PAGE } from '../config/settings';
const IconWrapper = styled.span`
cursor: pointer;
@@ -93,7 +94,7 @@ export const ExtraContent = () => {
const navigate = useNavigate();
const loginPath = '/login';
const loginPath = DEFAULT_ENTER_PAGE.login;
const showUpgrade = useMemo(() => {
return (
+9 -5
View File
@@ -9,6 +9,7 @@ import ShortCuts, {
} from '@/components/short-cuts';
import VersionInfo, { modalConfig } from '@/components/version-info';
import routeCachekey from '@/config/route-cachekey';
import { DEFAULT_ENTER_PAGE } from '@/config/settings';
import useBodyScroll from '@/hooks/use-body-scroll';
import useOverlayScroller from '@/hooks/use-overlay-scroller';
import useUserSettings from '@/hooks/use-user-settings';
@@ -54,7 +55,7 @@ const NO_CONTAINER_PAGES = [
'clusterCreate'
];
const loginPath = '/login';
const loginPath = DEFAULT_ENTER_PAGE.login;
type InitialStateType = {
fetchUserInfo: () => Promise<Global.UserInfo>;
@@ -408,8 +409,8 @@ export default (props: any) => {
history.push(loginPath);
} else if (location.pathname === '/') {
const pathname = initialState?.currentUser?.is_admin
? '/dashboard'
: '/playground';
? DEFAULT_ENTER_PAGE.adminForNormal
: DEFAULT_ENTER_PAGE.user;
history.push(pathname);
}
};
@@ -417,11 +418,14 @@ export default (props: any) => {
const onMenuHeaderClick = (e) => {
e.stopPropagation();
e.preventDefault();
navigate('/dashboard');
const pagepath = initialState?.currentUser?.is_admin
? DEFAULT_ENTER_PAGE.adminForNormal
: DEFAULT_ENTER_PAGE.user;
navigate(pagepath);
};
const onCollapse = (value) => {
// setCollapsed(value);
setUserSettings({
...userSettings,
collapsed: value