diff options
Diffstat (limited to 'src/features/workspaces/api.js')
-rw-r--r-- | src/features/workspaces/api.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/features/workspaces/api.js b/src/features/workspaces/api.js index 1ee2440fe..97badbd01 100644 --- a/src/features/workspaces/api.js +++ b/src/features/workspaces/api.js | |||
@@ -1,9 +1,13 @@ | |||
1 | // TODO: use real server instead | 1 | import { prepareAuthRequest } from '../../api/utils/auth'; |
2 | const workspaces = [ | 2 | import { API, API_VERSION } from '../../environment'; |
3 | { id: 'workspace-1', name: 'Private' }, | ||
4 | { id: 'workspace-2', name: 'Office' }, | ||
5 | ]; | ||
6 | 3 | ||
7 | export default { | 4 | export default { |
8 | getUserWorkspaces: () => Promise.resolve(workspaces), | 5 | getUserWorkspaces: async () => { |
6 | const url = `${API}/${API_VERSION}/workspace`; | ||
7 | const request = await window.fetch(url, prepareAuthRequest({ | ||
8 | method: 'GET', | ||
9 | })); | ||
10 | if (!request.ok) throw request; | ||
11 | return request.json(); | ||
12 | }, | ||
9 | }; | 13 | }; |