blob: fabc124554e40751640d7e9e6aec9b6effc3d292 (
plain) (
blame)
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
|
import { sendAuthRequest } from '../../api/utils/auth';
import { API, API_VERSION } from '../../environment';
export default {
getUserWorkspaces: async () => {
const url = `${API}/${API_VERSION}/workspace`;
const request = await sendAuthRequest(url, { method: 'GET' });
if (!request.ok) throw request;
return request.json();
},
createWorkspace: async (name) => {
const url = `${API}/${API_VERSION}/workspace`;
const request = await sendAuthRequest(url, {
method: 'POST',
body: JSON.stringify({ name }),
});
if (!request.ok) throw request;
return request.json();
},
deleteWorkspace: async (workspace) => {
const url = `${API}/${API_VERSION}/workspace/${workspace.id}`;
const request = await sendAuthRequest(url, { method: 'DELETE' });
if (!request.ok) throw request;
return request.json();
},
};
|