mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
feat: add show workspace names and members
This commit is contained in:
@@ -57,6 +57,7 @@ function parseAccessToken(token: string): AccessTokenMessage | null {
|
||||
const message: AccessTokenMessage = JSON.parse(
|
||||
b64DecodeUnicode(token.split('.')[1])
|
||||
);
|
||||
message.id = message.id.toString();
|
||||
return message;
|
||||
} catch (error) {
|
||||
return null;
|
||||
|
||||
@@ -2,7 +2,7 @@ export interface AccessTokenMessage {
|
||||
create_at: number;
|
||||
exp: number;
|
||||
email: string;
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
avatar_url: string;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface GetUserByEmailParams {
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
avatar_url: string;
|
||||
|
||||
@@ -46,7 +46,9 @@ export async function getWorkspaceDetail(
|
||||
url: `/api/workspace/${params.id}`,
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (data.data?.owner.id) {
|
||||
data.data.owner.id = String(data.data?.owner.id);
|
||||
}
|
||||
return data.data;
|
||||
}
|
||||
|
||||
@@ -199,3 +201,20 @@ export async function downloadWorkspace(
|
||||
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function uploadBlob(params: { blob: Blob }): Promise<string> {
|
||||
const data = await request({
|
||||
url: '/api/blob',
|
||||
method: 'PUT',
|
||||
data: params.blob,
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function getBlob(params: { blobId: string }): Promise<string> {
|
||||
const data = await request({
|
||||
url: `/api/blob/${params.blobId}`,
|
||||
method: 'GET',
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user