summaryrefslogtreecommitdiff
path: root/src/misc
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/misc
parenta265c62020d4dd3a4e57e5ad0894794461dd8385 (diff)
feat: initial theming support
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/request-helper.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/misc/request-helper.js b/src/misc/request-helper.js
index 7cc17bf..317dada 100644
--- a/src/misc/request-helper.js
+++ b/src/misc/request-helper.js
@@ -1,15 +1,7 @@
-import { store } from '../store/configureStore';
-import { getClashAPIConfig } from 'd/app';
-
const headersCommon = {
'Content-Type': 'application/json'
};
-export function getAPIConfig() {
- // this is cheating...
- return getClashAPIConfig(store.getState());
-}
-
export function genCommonHeaders({ secret }) {
const h = { ...headersCommon };
if (secret) {
@@ -21,3 +13,12 @@ export function genCommonHeaders({ secret }) {
export function getAPIBaseURL({ hostname, port }) {
return `http://${hostname}:${port}`;
}
+
+export function getURLAndInit({ hostname, port, secret }) {
+ const baseURL = getAPIBaseURL({ hostname, port });
+ const headers = genCommonHeaders({ secret });
+ return {
+ url: baseURL,
+ init: { headers }
+ };
+}