diff --git a/packages/client/src/components/auth-layout/index.tsx b/packages/client/src/components/auth-layout/index.tsx index 578364a91d..ddd8a8ba3c 100644 --- a/packages/client/src/components/auth-layout/index.tsx +++ b/packages/client/src/components/auth-layout/index.tsx @@ -1,3 +1,4 @@ +import { Card } from 'antd'; import React from 'react'; import { useLocation, useHistory } from 'react-router-dom'; @@ -5,7 +6,7 @@ export function AuthLayout({ children, route }: any) { const location = useLocation(); const history = useHistory(); return ( -
+

NocoBase

{children}
diff --git a/packages/client/src/components/route-schema-renderer/index.tsx b/packages/client/src/components/route-schema-renderer/index.tsx index a9a0648452..2bb5ee4b08 100644 --- a/packages/client/src/components/route-schema-renderer/index.tsx +++ b/packages/client/src/components/route-schema-renderer/index.tsx @@ -4,7 +4,7 @@ import { Helmet } from 'react-helmet'; import { useRequest } from 'ahooks'; import { request, SchemaRenderer } from '../../schemas'; import { useForm } from '@formily/react'; -import { useHistory } from 'react-router-dom'; +import { useHistory, useLocation } from 'react-router-dom'; function Div(props) { return
; @@ -13,6 +13,9 @@ function Div(props) { export function useLogin() { const form = useForm(); const history = useHistory(); + const location = useLocation(); + const query = new URLSearchParams(location.search); + const redirect = query.get('redirect'); return { async run() { await form.submit(); @@ -20,9 +23,8 @@ export function useLogin() { method: 'post', data: form.values, }); - history.push('/admin'); + history.push(redirect || '/admin'); localStorage.setItem('NOCOBASE_TOKEN', data?.data?.token); - console.log('NOCOBASE_TOKEN', data?.data?.token); }, }; }