mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 13:29:02 +08:00
feat: mock login
This commit is contained in:
@@ -8,7 +8,7 @@ export interface Workspace {
|
||||
workspaceOwner?: User; // 本地工作空间的拥有者
|
||||
}
|
||||
|
||||
interface User {
|
||||
export interface User {
|
||||
name: string;
|
||||
id: string;
|
||||
email: string;
|
||||
@@ -109,3 +109,23 @@ export function setActiveWorkspace(workspaceData: Workspace) {
|
||||
JSON.stringify(workspaceData)
|
||||
);
|
||||
}
|
||||
|
||||
export function getUserInfo(): User {
|
||||
return JSON.parse(localStorage.getItem('affine-user') ?? 'null');
|
||||
}
|
||||
|
||||
export function Login(): void {
|
||||
localStorage.setItem(
|
||||
'affine-user',
|
||||
JSON.stringify({
|
||||
name: 'Diamond',
|
||||
id: 'ttt',
|
||||
email: 'diamond.shx@gmail.com',
|
||||
avatar: 'string',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export function SignOut(): void {
|
||||
localStorage.removeItem('affine-user');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user