feat: add logout button in switch workspace page

This commit is contained in:
moonrailgun 2024-09-14 22:14:11 +08:00
parent 2b9a14c969
commit 6ce2f7fd4d
2 changed files with 11 additions and 8 deletions

View File

@ -37,7 +37,7 @@ function PageComponent() {
<Form layout="vertical">
<Form.Item label={t('Current Workspace Id')}>
<Typography.Text copyable={true} code={true}>
{userInfo?.currentWorkspace?.id}
{userInfo?.currentWorkspaceId}
</Typography.Text>
</Form.Item>
<Form.Item label={t('User Id')}>

View File

@ -16,6 +16,7 @@ import {
import { WorkspaceSwitcher } from '@/components/WorkspaceSwitcher';
import { Button } from '@/components/ui/button';
import { useEvent } from '@/hooks/useEvent';
import { useAuth } from '@/api/authjs/useAuth';
export const Route = createFileRoute('/switchWorkspace')({
validateSearch: z.object({
@ -45,6 +46,7 @@ function PageComponent() {
const currentWorkspace = useCurrentWorkspaceSafe();
const search = Route.useSearch();
const navigate = useNavigate();
const { logout } = useAuth();
const handleEnter = useEvent(() => {
navigate({
@ -66,13 +68,14 @@ function PageComponent() {
<WorkspaceSwitcher isCollapsed={false} />
</CardContent>
{currentWorkspace && (
<CardFooter className="justify-end">
<Button size="sm" onClick={handleEnter}>
{t('Enter')}
</Button>
</CardFooter>
)}
<CardFooter className="justify-end gap-2">
<Button size="sm" variant="outline" onClick={logout}>
{t('Logout')}
</Button>
<Button disabled={!currentWorkspace} size="sm" onClick={handleEnter}>
{t('Enter')}
</Button>
</CardFooter>
</Card>
</div>
);