mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor: login method (#1676)
This commit is contained in:
@@ -11,8 +11,16 @@ import {
|
||||
} from '@affine/workspace/affine/login';
|
||||
import { useAtom } from 'jotai';
|
||||
import type { NextPage } from 'next';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
const Viewer = dynamic(
|
||||
() => import('@rich-data/viewer').then(m => ({ default: m.JsonViewer })),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
import { StyledPage, StyledWrapper } from '../../layouts/styles';
|
||||
|
||||
const LoginDevPage: NextPage = () => {
|
||||
@@ -69,7 +77,24 @@ const LoginDevPage: NextPage = () => {
|
||||
>
|
||||
Reset Storage
|
||||
</Button>
|
||||
{user && JSON.stringify(user)}
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const status = await fetch('/api/workspace', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
Authorization: getLoginStorage()?.token ?? '',
|
||||
},
|
||||
}).then(r => r.status);
|
||||
toast(`Response Status: ${status}`);
|
||||
}}
|
||||
>
|
||||
Check Permission
|
||||
</Button>
|
||||
<Viewer
|
||||
theme={useTheme().resolvedTheme === 'light' ? 'light' : 'dark'}
|
||||
value={user}
|
||||
/>
|
||||
</StyledWrapper>
|
||||
</StyledPage>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user