()
| 1 | import { API_HOST } from "../config/settings"; |
| 2 | |
| 3 | function checkForUpdates() { |
| 4 | const url = `${API_HOST}/update`; |
| 5 | const method = "GET"; |
| 6 | const headers = new Headers({ |
| 7 | "Accept": "application/json", |
| 8 | }); |
| 9 | |
| 10 | return fetch(url, { method, headers }) |
| 11 | .then((response) => { |
| 12 | if (!response.ok) return Promise.reject(response.statusCode); |
| 13 | |
| 14 | return response.json(); |
| 15 | }) |
| 16 | .then((data) => { |
| 17 | return data; |
| 18 | }) |
| 19 | .catch((err) => { |
| 20 | return Promise.reject(err); |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | export default checkForUpdates; |