aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-04-22 15:04:21 -0500
committerLibravatar GitHub <noreply@github.com>2022-04-22 20:04:21 +0000
commit759d93dc198a3cc8c5265245c0144efa5435682b (patch)
tree53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/features/workspaces
parentAdded build scripts for linux, macos and windows to help new contributors get... (diff)
downloadferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.gz
ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.zst
ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.zip
Turn off usage of 'debug' npm package using with electron-16 (fixes #17)
Diffstat (limited to 'src/features/workspaces')
-rw-r--r--src/features/workspaces/api.ts19
-rw-r--r--src/features/workspaces/store.js9
2 files changed, 15 insertions, 13 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 }
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index 1f3d57c24..d2ccfeccf 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -15,7 +15,8 @@ import { createActionBindings } from '../utils/ActionBinding';
15 15
16import { KEEP_WS_LOADED_USID } from '../../config'; 16import { KEEP_WS_LOADED_USID } from '../../config';
17 17
18const debug = require('debug')('Ferdium:feature:workspaces:store'); 18// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed
19// const debug = require('debug')('Ferdium:feature:workspaces:store');
19 20
20export default class WorkspacesStore extends FeatureStore { 21export default class WorkspacesStore extends FeatureStore {
21 @observable isFeatureActive = false; 22 @observable isFeatureActive = false;
@@ -69,7 +70,7 @@ export default class WorkspacesStore extends FeatureStore {
69 // ========== PUBLIC API ========= // 70 // ========== PUBLIC API ========= //
70 71
71 @action start(stores, actions) { 72 @action start(stores, actions) {
72 debug('WorkspacesStore::start'); 73 console.log('WorkspacesStore::start');
73 this.stores = stores; 74 this.stores = stores;
74 this.actions = actions; 75 this.actions = actions;
75 76
@@ -115,7 +116,7 @@ export default class WorkspacesStore extends FeatureStore {
115 116
116 @action stop() { 117 @action stop() {
117 super.stop(); 118 super.stop();
118 debug('WorkspacesStore::stop'); 119 console.log('WorkspacesStore::stop');
119 this.reset(); 120 this.reset();
120 this.isFeatureActive = false; 121 this.isFeatureActive = false;
121 } 122 }
@@ -273,7 +274,7 @@ export default class WorkspacesStore extends FeatureStore {
273 }; 274 };
274 275
275 _activateLastUsedWorkspaceReaction = () => { 276 _activateLastUsedWorkspaceReaction = () => {
276 debug('_activateLastUsedWorkspaceReaction'); 277 console.log('_activateLastUsedWorkspaceReaction');
277 if (!this.activeWorkspace && this.userHasWorkspaces) { 278 if (!this.activeWorkspace && this.userHasWorkspaces) {
278 const { lastActiveWorkspace } = this.settings; 279 const { lastActiveWorkspace } = this.settings;
279 if (lastActiveWorkspace) { 280 if (lastActiveWorkspace) {