mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat: add public workspace page api (#1791)
This commit is contained in:
@@ -233,13 +233,16 @@ export function createWorkspaceApis(prefixUrl = '/') {
|
||||
throw new RequestError(MessageCode.getMembersFailed, e);
|
||||
});
|
||||
},
|
||||
createWorkspace: async (encodedYDoc: Blob): Promise<{ id: string }> => {
|
||||
createWorkspace: async (
|
||||
encodedYDoc: ArrayBuffer
|
||||
): Promise<{ id: string }> => {
|
||||
const auth = getLoginStorage();
|
||||
assertExists(auth);
|
||||
return fetch(prefixUrl + 'api/workspace', {
|
||||
method: 'POST',
|
||||
body: encodedYDoc,
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
Authorization: auth.token,
|
||||
},
|
||||
})
|
||||
@@ -382,6 +385,17 @@ export function createWorkspaceApis(prefixUrl = '/') {
|
||||
throw new RequestError(MessageCode.leaveWorkspaceFailed, e);
|
||||
});
|
||||
},
|
||||
downloadPublicWorkspacePage: async (
|
||||
workspaceId: string,
|
||||
pageId: string
|
||||
): Promise<ArrayBuffer> => {
|
||||
return fetch(
|
||||
prefixUrl + `api/public/workspace/${workspaceId}/${pageId}`,
|
||||
{
|
||||
method: 'GET',
|
||||
}
|
||||
).then(r => r.arrayBuffer());
|
||||
},
|
||||
downloadWorkspace: async (
|
||||
workspaceId: string,
|
||||
published = false
|
||||
|
||||
Reference in New Issue
Block a user