diff options
| author | Haishan <[email protected]> | 2018-12-04 23:39:26 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2018-12-07 00:19:49 +0800 |
| commit | 3584ff617966af35ddd0fd45ef2df7cdfb8f5071 (patch) | |
| tree | 83f4f535d1fd3ca1c85807a1c2b397cf9b6733c5 /src/api/configs.js | |
| parent | a265c62020d4dd3a4e57e5ad0894794461dd8385 (diff) | |
feat: initial theming support
Diffstat (limited to 'src/api/configs.js')
| -rw-r--r-- | src/api/configs.js | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/api/configs.js b/src/api/configs.js index 0690221..8889ad0 100644 --- a/src/api/configs.js +++ b/src/api/configs.js @@ -1,29 +1,19 @@ import { - getAPIConfig, + getURLAndInit, genCommonHeaders, getAPIBaseURL } from 'm/request-helper'; const endpoint = '/configs'; -function getURLAndInit() { - const c = getAPIConfig(); - const baseURL = getAPIBaseURL(c); - const headers = genCommonHeaders(c); - return { - url: baseURL + endpoint, - init: { headers } - }; +export async function fetchConfigs(apiConfig) { + const { url, init } = getURLAndInit(apiConfig); + return await fetch(url + endpoint, init); } -export async function fetchConfigs() { - const { url, init } = getURLAndInit(); - return await fetch(url, init); -} - -export async function updateConfigs(o) { - const { url, init } = getURLAndInit(); - return await fetch(url, { +export async function updateConfigs(apiConfig, o) { + const { url, init } = getURLAndInit(apiConfig); + return await fetch(url + endpoint, { ...init, method: 'PUT', // mode: 'cors', |
