-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathapi.js
More file actions
29 lines (24 loc) · 734 Bytes
/
api.js
File metadata and controls
29 lines (24 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { request } from "./index.js";
export const getRootDouments = async () => {
return await request("/documents");
};
export const getDocumentContent = async (documentId) => {
return await request(`/documents/${documentId}`);
};
export const createDocument = async (documentData) => {
return await request(`/documents`, {
method: "POST",
body: JSON.stringify(documentData),
});
};
export const modifyDocuments = async (documentId, documentData) => {
return await request(`/documents/${documentId}`, {
method: "PUT",
body: JSON.stringify(documentData),
});
};
export const deleteDocument = async (documentId) => {
return await request(`/documents/${documentId}`, {
method: "DELETE",
});
};