From f6826d73fac4164cd6cb86d44903ddf64440e919 Mon Sep 17 00:00:00 2001 From: DiamondThree <857159145@qq.com> Date: Mon, 9 Jan 2023 21:41:55 +0800 Subject: [PATCH] feat: user login --- .../src/components/workspace-modal/index.tsx | 6 ++++-- packages/app/src/hooks/use-user-helper.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 packages/app/src/hooks/use-user-helper.ts diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 6747e58da1..f4e5403a5a 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -15,6 +15,7 @@ import { toast } from '@/ui/toast'; import { WorkspaceAvatar } from '@/components/workspace-avatar'; import { useAppState } from '@/providers/app-state-provider'; import { useRouter } from 'next/router'; +import { useUserHelper } from '@/hooks/use-user-helper'; interface WorkspaceModalProps { open: boolean; @@ -24,7 +25,8 @@ interface WorkspaceModalProps { export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { const [createWorkspaceOpen, setCreateWorkspaceOpen] = useState(false); const { confirm } = useConfirm(); - const { user, workspaceList, currentWorkspace } = useAppState(); + const { workspaceList, currentWorkspace } = useAppState(); + const { login, user } = useUserHelper(); const router = useRouter(); return (
@@ -132,7 +134,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { {!user ? (