diff options
author | 2018-02-26 16:43:57 +0100 | |
---|---|---|
committer | 2018-02-26 16:43:57 +0100 | |
commit | d1e6f03395b4d2b668a8da6260aca8adf823f1db (patch) | |
tree | 7153ce10c48f1ba6453999bca8e4ba8a8aa410eb /src/api | |
parent | initial commit (diff) | |
download | ferdium-app-d1e6f03395b4d2b668a8da6260aca8adf823f1db.tar.gz ferdium-app-d1e6f03395b4d2b668a8da6260aca8adf823f1db.tar.zst ferdium-app-d1e6f03395b4d2b668a8da6260aca8adf823f1db.zip |
ADD `features` request
REFACTOR `defaults` -> `base`
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/FeaturesApi.js | 8 | ||||
-rw-r--r-- | src/api/server/ServerApi.js | 20 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/api/FeaturesApi.js b/src/api/FeaturesApi.js index 5749ab336..292dc80cc 100644 --- a/src/api/FeaturesApi.js +++ b/src/api/FeaturesApi.js | |||
@@ -3,7 +3,11 @@ export default class FeaturesApi { | |||
3 | this.server = server; | 3 | this.server = server; |
4 | } | 4 | } |
5 | 5 | ||
6 | defaults() { | 6 | base() { |
7 | return this.server.getDefaultFeatures(); | 7 | return this.server.getBaseFeatures(); |
8 | } | ||
9 | |||
10 | features() { | ||
11 | return this.server.getFeatures(); | ||
8 | } | 12 | } |
9 | } | 13 | } |
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 0951dfeda..ad7988bb2 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -260,8 +260,8 @@ export default class ServerApi { | |||
260 | } | 260 | } |
261 | 261 | ||
262 | // Features | 262 | // Features |
263 | async getDefaultFeatures() { | 263 | async getBaseFeatures() { |
264 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/features/default`, this._prepareAuthRequest({ | 264 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/features/base`, this._prepareAuthRequest({ |
265 | method: 'GET', | 265 | method: 'GET', |
266 | })); | 266 | })); |
267 | if (!request.ok) { | 267 | if (!request.ok) { |
@@ -270,7 +270,21 @@ export default class ServerApi { | |||
270 | const data = await request.json(); | 270 | const data = await request.json(); |
271 | 271 | ||
272 | const features = data; | 272 | const features = data; |
273 | console.debug('ServerApi::getDefaultFeatures resolves', features); | 273 | console.debug('ServerApi::getBaseFeatures resolves', features); |
274 | return features; | ||
275 | } | ||
276 | |||
277 | async getFeatures() { | ||
278 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/features`, this._prepareAuthRequest({ | ||
279 | method: 'GET', | ||
280 | })); | ||
281 | if (!request.ok) { | ||
282 | throw request; | ||
283 | } | ||
284 | const data = await request.json(); | ||
285 | |||
286 | const features = data; | ||
287 | console.debug('ServerApi::getFeatures resolves', features); | ||
274 | return features; | 288 | return features; |
275 | } | 289 | } |
276 | 290 | ||