feat: add logout button in switch workspace page
This commit is contained in:
parent
2b9a14c969
commit
6ce2f7fd4d
@ -37,7 +37,7 @@ function PageComponent() {
|
|||||||
<Form layout="vertical">
|
<Form layout="vertical">
|
||||||
<Form.Item label={t('Current Workspace Id')}>
|
<Form.Item label={t('Current Workspace Id')}>
|
||||||
<Typography.Text copyable={true} code={true}>
|
<Typography.Text copyable={true} code={true}>
|
||||||
{userInfo?.currentWorkspace?.id}
|
{userInfo?.currentWorkspaceId}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t('User Id')}>
|
<Form.Item label={t('User Id')}>
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
import { WorkspaceSwitcher } from '@/components/WorkspaceSwitcher';
|
import { WorkspaceSwitcher } from '@/components/WorkspaceSwitcher';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useEvent } from '@/hooks/useEvent';
|
import { useEvent } from '@/hooks/useEvent';
|
||||||
|
import { useAuth } from '@/api/authjs/useAuth';
|
||||||
|
|
||||||
export const Route = createFileRoute('/switchWorkspace')({
|
export const Route = createFileRoute('/switchWorkspace')({
|
||||||
validateSearch: z.object({
|
validateSearch: z.object({
|
||||||
@ -45,6 +46,7 @@ function PageComponent() {
|
|||||||
const currentWorkspace = useCurrentWorkspaceSafe();
|
const currentWorkspace = useCurrentWorkspaceSafe();
|
||||||
const search = Route.useSearch();
|
const search = Route.useSearch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { logout } = useAuth();
|
||||||
|
|
||||||
const handleEnter = useEvent(() => {
|
const handleEnter = useEvent(() => {
|
||||||
navigate({
|
navigate({
|
||||||
@ -66,13 +68,14 @@ function PageComponent() {
|
|||||||
<WorkspaceSwitcher isCollapsed={false} />
|
<WorkspaceSwitcher isCollapsed={false} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
||||||
{currentWorkspace && (
|
<CardFooter className="justify-end gap-2">
|
||||||
<CardFooter className="justify-end">
|
<Button size="sm" variant="outline" onClick={logout}>
|
||||||
<Button size="sm" onClick={handleEnter}>
|
{t('Logout')}
|
||||||
{t('Enter')}
|
</Button>
|
||||||
</Button>
|
<Button disabled={!currentWorkspace} size="sm" onClick={handleEnter}>
|
||||||
</CardFooter>
|
{t('Enter')}
|
||||||
)}
|
</Button>
|
||||||
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user