diff options
author | vantezzen <properly@protonmail.com> | 2019-08-23 12:57:46 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-08-23 12:57:46 +0200 |
commit | ed987f542626c0d7b7c5cb4ef18beeeace67885f (patch) | |
tree | bf7d0eeb25b95f7f8a5ebb1691d90df899a48d31 /src/features/workspaces/api.js | |
parent | Autofix npm audit (diff) | |
download | ferdium-app-ed987f542626c0d7b7c5cb4ef18beeeace67885f.tar.gz ferdium-app-ed987f542626c0d7b7c5cb4ef18beeeace67885f.tar.zst ferdium-app-ed987f542626c0d7b7c5cb4ef18beeeace67885f.zip |
Use API URL from store for workspaces and announcements
Diffstat (limited to 'src/features/workspaces/api.js')
-rw-r--r-- | src/features/workspaces/api.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/features/workspaces/api.js b/src/features/workspaces/api.js index 0ec20c9ea..ff0e54a7a 100644 --- a/src/features/workspaces/api.js +++ b/src/features/workspaces/api.js | |||
@@ -1,14 +1,14 @@ | |||
1 | import { pick } from 'lodash'; | 1 | import { pick } from 'lodash'; |
2 | import { sendAuthRequest } from '../../api/utils/auth'; | 2 | import { sendAuthRequest } from '../../api/utils/auth'; |
3 | import { API, API_VERSION } from '../../environment'; | ||
4 | import Request from '../../stores/lib/Request'; | 3 | import Request from '../../stores/lib/Request'; |
5 | import Workspace from './models/Workspace'; | 4 | import Workspace from './models/Workspace'; |
5 | import apiBase from '../apiBase' | ||
6 | 6 | ||
7 | const debug = require('debug')('Franz:feature:workspaces:api'); | 7 | const debug = require('debug')('Franz:feature:workspaces:api'); |
8 | 8 | ||
9 | export const workspaceApi = { | 9 | export const workspaceApi = { |
10 | getUserWorkspaces: async () => { | 10 | getUserWorkspaces: async () => { |
11 | const url = `${API}/${API_VERSION}/workspace`; | 11 | const url = `${apiBase()}/workspace`; |
12 | debug('getUserWorkspaces GET', url); | 12 | debug('getUserWorkspaces GET', url); |
13 | const result = await sendAuthRequest(url, { method: 'GET' }); | 13 | const result = await sendAuthRequest(url, { method: 'GET' }); |
14 | debug('getUserWorkspaces RESULT', result); | 14 | debug('getUserWorkspaces RESULT', result); |
@@ -18,7 +18,7 @@ export const workspaceApi = { | |||
18 | }, | 18 | }, |
19 | 19 | ||
20 | createWorkspace: async (name) => { | 20 | createWorkspace: async (name) => { |
21 | const url = `${API}/${API_VERSION}/workspace`; | 21 | const url = `${apiBase()}/workspace`; |
22 | const options = { | 22 | const options = { |
23 | method: 'POST', | 23 | method: 'POST', |
24 | body: JSON.stringify({ name }), | 24 | body: JSON.stringify({ name }), |
@@ -31,7 +31,7 @@ export const workspaceApi = { | |||
31 | }, | 31 | }, |
32 | 32 | ||
33 | deleteWorkspace: async (workspace) => { | 33 | deleteWorkspace: async (workspace) => { |
34 | const url = `${API}/${API_VERSION}/workspace/${workspace.id}`; | 34 | const url = `${apiBase()}/workspace/${workspace.id}`; |
35 | debug('deleteWorkspace DELETE', url); | 35 | debug('deleteWorkspace DELETE', url); |
36 | const result = await sendAuthRequest(url, { method: 'DELETE' }); | 36 | const result = await sendAuthRequest(url, { method: 'DELETE' }); |
37 | debug('deleteWorkspace RESULT', result); | 37 | debug('deleteWorkspace RESULT', result); |
@@ -40,7 +40,7 @@ export const workspaceApi = { | |||
40 | }, | 40 | }, |
41 | 41 | ||
42 | updateWorkspace: async (workspace) => { | 42 | updateWorkspace: async (workspace) => { |
43 | const url = `${API}/${API_VERSION}/workspace/${workspace.id}`; | 43 | const url = `${apiBase()}/workspace/${workspace.id}`; |
44 | const options = { | 44 | const options = { |
45 | method: 'PUT', | 45 | method: 'PUT', |
46 | body: JSON.stringify(pick(workspace, ['name', 'services'])), | 46 | body: JSON.stringify(pick(workspace, ['name', 'services'])), |