diff options
author | 2021-06-05 07:58:00 +0530 | |
---|---|---|
committer | 2021-06-05 08:03:31 +0530 | |
commit | 368471dba24587415cae04ca33879404fb8639a5 (patch) | |
tree | b216754eed7d6f478ceefea9ef3c0ab5698581d4 /src/features/announcements | |
parent | Upgraded electron to '13.1.1'. (diff) | |
download | ferdium-app-368471dba24587415cae04ca33879404fb8639a5.tar.gz ferdium-app-368471dba24587415cae04ca33879404fb8639a5.tar.zst ferdium-app-368471dba24587415cae04ca33879404fb8639a5.zip |
Reused commonly defined method for 'apiBase'
Diffstat (limited to 'src/features/announcements')
-rw-r--r-- | src/features/announcements/api.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/features/announcements/api.js b/src/features/announcements/api.js index 2ab5a15b2..2c4d11d05 100644 --- a/src/features/announcements/api.js +++ b/src/features/announcements/api.js | |||
@@ -1,5 +1,6 @@ | |||
1 | import { app } from '@electron/remote'; | 1 | import { app } from '@electron/remote'; |
2 | import Request from '../../stores/lib/Request'; | 2 | import Request from '../../stores/lib/Request'; |
3 | import apiBase from '../../api/apiBase'; | ||
3 | 4 | ||
4 | const debug = require('debug')('Ferdi:feature:announcements:api'); | 5 | const debug = require('debug')('Ferdi:feature:announcements:api'); |
5 | 6 | ||
@@ -10,8 +11,8 @@ export const announcementsApi = { | |||
10 | }, | 11 | }, |
11 | 12 | ||
12 | async getChangelog(version) { | 13 | async getChangelog(version) { |
13 | debug('fetching release changelog from Github'); | ||
14 | const url = `https://api.github.com/repos/getferdi/ferdi/releases/tags/v${version}`; | 14 | const url = `https://api.github.com/repos/getferdi/ferdi/releases/tags/v${version}`; |
15 | debug(`fetching release changelog from Github url: ${url}`); | ||
15 | const request = await window.fetch(url, { method: 'GET' }); | 16 | const request = await window.fetch(url, { method: 'GET' }); |
16 | if (!request.ok) return null; | 17 | if (!request.ok) return null; |
17 | const data = await request.json(); | 18 | const data = await request.json(); |
@@ -19,8 +20,8 @@ export const announcementsApi = { | |||
19 | }, | 20 | }, |
20 | 21 | ||
21 | async getAnnouncement(version) { | 22 | async getAnnouncement(version) { |
22 | debug('fetching release announcement from api'); | 23 | const url = `${apiBase(true)}/announcements/${version}`; |
23 | const url = `https://api.getferdi.com/v1/announcements/${version}`; | 24 | debug(`fetching release announcement from api url: ${url}`); |
24 | const response = await window.fetch(url, { method: 'GET' }); | 25 | const response = await window.fetch(url, { method: 'GET' }); |
25 | if (!response.ok) return null; | 26 | if (!response.ok) return null; |
26 | return response.json(); | 27 | return response.json(); |