summaryrefslogtreecommitdiff
path: root/src/api/logs.js
diff options
context:
space:
mode:
authorHaishan <[email protected]>2018-12-04 23:39:26 +0800
committerHaishan <[email protected]>2018-12-07 00:19:49 +0800
commit3584ff617966af35ddd0fd45ef2df7cdfb8f5071 (patch)
tree83f4f535d1fd3ca1c85807a1c2b397cf9b6733c5 /src/api/logs.js
parenta265c62020d4dd3a4e57e5ad0894794461dd8385 (diff)
feat: initial theming support
Diffstat (limited to 'src/api/logs.js')
-rw-r--r--src/api/logs.js18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/api/logs.js b/src/api/logs.js
index 59d064a..948a23f 100644
--- a/src/api/logs.js
+++ b/src/api/logs.js
@@ -1,5 +1,5 @@
import {
- getAPIConfig,
+ getURLAndInit,
genCommonHeaders,
getAPIBaseURL
} from 'm/request-helper';
@@ -10,16 +10,6 @@ const getRandomStr = () => {
return Math.floor((1 + Math.random()) * 0x10000).toString(16);
};
-function getURLAndInit() {
- const c = getAPIConfig();
- const baseURL = getAPIBaseURL(c);
- const headers = genCommonHeaders(c);
- return {
- url: baseURL + endpoint,
- init: { headers }
- };
-}
-
const Size = 300;
let even = false;
@@ -71,11 +61,11 @@ function pump(reader) {
});
}
-function fetchLogs() {
+function fetchLogs(apiConfig) {
if (store.fetched) return store;
store.fetched = true;
- const { url, init } = getURLAndInit();
- fetch(url, init)
+ const { url, init } = getURLAndInit(apiConfig);
+ fetch(url + endpoint, init)
.then(response => {
const reader = response.body.getReader();
pump(reader);