aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/api.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/workspaces/api.ts')
-rw-r--r--src/features/workspaces/api.ts19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/features/workspaces/api.ts b/src/features/workspaces/api.ts
index 3c8cbbceb..582433527 100644
--- a/src/features/workspaces/api.ts
+++ b/src/features/workspaces/api.ts
@@ -4,14 +4,15 @@ import Request from '../../stores/lib/Request';
4import Workspace from './models/Workspace'; 4import Workspace from './models/Workspace';
5import apiBase from '../../api/apiBase'; 5import apiBase from '../../api/apiBase';
6 6
7const debug = require('debug')('Ferdium:feature:workspaces:api'); 7// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed
8// const debug = require('debug')('Ferdium:feature:workspaces:api');
8 9
9export const workspaceApi = { 10export const workspaceApi = {
10 getUserWorkspaces: async () => { 11 getUserWorkspaces: async () => {
11 const url = `${apiBase()}/workspace`; 12 const url = `${apiBase()}/workspace`;
12 debug('getUserWorkspaces GET', url); 13 console.log('getUserWorkspaces GET', url);
13 const result = await sendAuthRequest(url, { method: 'GET' }); 14 const result = await sendAuthRequest(url, { method: 'GET' });
14 debug('getUserWorkspaces RESULT', result); 15 console.log('getUserWorkspaces RESULT', result);
15 if (!result.ok) { 16 if (!result.ok) {
16 throw new Error("Couldn't getUserWorkspaces"); 17 throw new Error("Couldn't getUserWorkspaces");
17 } 18 }
@@ -25,9 +26,9 @@ export const workspaceApi = {
25 method: 'POST', 26 method: 'POST',
26 body: JSON.stringify({ name }), 27 body: JSON.stringify({ name }),
27 }; 28 };
28 debug('createWorkspace POST', url, options); 29 console.log('createWorkspace POST', url, options);
29 const result = await sendAuthRequest(url, options); 30 const result = await sendAuthRequest(url, options);
30 debug('createWorkspace RESULT', result); 31 console.log('createWorkspace RESULT', result);
31 if (!result.ok) { 32 if (!result.ok) {
32 throw new Error("Couldn't createWorkspace"); 33 throw new Error("Couldn't createWorkspace");
33 } 34 }
@@ -36,9 +37,9 @@ export const workspaceApi = {
36 37
37 deleteWorkspace: async workspace => { 38 deleteWorkspace: async workspace => {
38 const url = `${apiBase()}/workspace/${workspace.id}`; 39 const url = `${apiBase()}/workspace/${workspace.id}`;
39 debug('deleteWorkspace DELETE', url); 40 console.log('deleteWorkspace DELETE', url);
40 const result = await sendAuthRequest(url, { method: 'DELETE' }); 41 const result = await sendAuthRequest(url, { method: 'DELETE' });
41 debug('deleteWorkspace RESULT', result); 42 console.log('deleteWorkspace RESULT', result);
42 if (!result.ok) { 43 if (!result.ok) {
43 throw new Error("Couldn't deleteWorkspace"); 44 throw new Error("Couldn't deleteWorkspace");
44 } 45 }
@@ -51,9 +52,9 @@ export const workspaceApi = {
51 method: 'PUT', 52 method: 'PUT',
52 body: JSON.stringify(pick(workspace, ['name', 'services'])), 53 body: JSON.stringify(pick(workspace, ['name', 'services'])),
53 }; 54 };
54 debug('updateWorkspace UPDATE', url, options); 55 console.log('updateWorkspace UPDATE', url, options);
55 const result = await sendAuthRequest(url, options); 56 const result = await sendAuthRequest(url, options);
56 debug('updateWorkspace RESULT', result); 57 console.log('updateWorkspace RESULT', result);
57 if (!result.ok) { 58 if (!result.ok) {
58 throw new Error("Couldn't updateWorkspace"); 59 throw new Error("Couldn't updateWorkspace");
59 } 60 }