File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ const redirectToLogin = () => {
4545 const redirectAfterLogin = encodeURIComponent(location.href);
4646 const search = `redirect=${redirectAfterLogin}`;
4747 const pathname = location.pathname.startsWith('/user')
48- ? '/user/ login'
49- : '/login';
50- window.location.href = `${pathname}?${search} `;
48+ ? '/login'
49+ : '/login/admin ';
50+ window.location.href = `${pathname}`;
5151};
5252
5353type ExtractDataProp<T > = T extends { data?: infer U } ? U : never
Original file line number Diff line number Diff line change @@ -65,9 +65,9 @@ const redirectToLogin = () => {
6565 const redirectAfterLogin = encodeURIComponent ( location . href ) ;
6666 const search = `redirect=${ redirectAfterLogin } ` ;
6767 const pathname = location . pathname . startsWith ( "/user" )
68- ? "/user/ login"
69- : "/login" ;
70- window . location . href = `${ pathname } ? ${ search } ` ;
68+ ? "/login"
69+ : "/login/admin " ;
70+ window . location . href = `${ pathname } ` ;
7171} ;
7272
7373type ExtractDataProp < T > = T extends { data ?: infer U } ? U : never ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const Header = () => {
1717 await postAdminLogout ( ) ;
1818 }
1919 message . success ( '退出登录成功' ) ;
20- navigate ( pathname . startsWith ( '/user' ) ? '/user/ login' : '/login' ) ;
20+ navigate ( pathname . startsWith ( '/user' ) ? '/login/user ' : '/login/admin ' ) ;
2121 } ;
2222 return (
2323 < Stack
Original file line number Diff line number Diff line change @@ -107,18 +107,26 @@ const App = () => {
107107
108108 const getUser = ( ) => {
109109 setLoading ( true ) ;
110- if ( location . pathname . startsWith ( '/user' ) ) {
110+ if (
111+ location . pathname . startsWith ( '/user' ) ||
112+ location . pathname === '/login' ||
113+ location . pathname === '/login/user'
114+ ) {
111115 return getUserProfile ( )
112116 . then ( ( res ) => {
113117 setUser ( res ) ;
114- if ( location . pathname . startsWith ( '/user/ login' ) ) {
118+ if ( location . pathname . startsWith ( '/login' ) ) {
115119 onGotoRedirect ( 'user' ) ;
116120 }
117121 } )
118122 . finally ( ( ) => {
119123 setLoading ( false ) ;
120124 } ) ;
121- } else if ( ! location . pathname . startsWith ( '/auth' ) ) {
125+ } else if (
126+ ! location . pathname . startsWith ( '/auth' ) ||
127+ ! location . pathname . startsWith ( '/user' ) ||
128+ location . pathname === '/login/admin'
129+ ) {
122130 return getAdminProfile ( )
123131 . then ( ( res ) => {
124132 setUser ( res ) ;
You can’t perform that action at this time.
0 commit comments