move constants to separated file
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
const BASE_URL = 'https://demo.remark42.com';
|
||||
const API_BASE = '/api/v1';
|
||||
const NODE_ID = 'remark42';
|
||||
|
||||
module.exports = {
|
||||
BASE_URL,
|
||||
API_BASE,
|
||||
NODE_ID,
|
||||
};
|
||||
@@ -3,7 +3,8 @@ import 'common/promises';
|
||||
// TODO: i think we need to use unfetch here instead of heavy axios
|
||||
import axios from 'axios';
|
||||
|
||||
import { baseUrl, apiBase, siteId } from './settings';
|
||||
import { BASE_URL, API_BASE } from './constants';
|
||||
import { siteId } from './settings';
|
||||
|
||||
const fetcher = {};
|
||||
const methods = ['get', 'post', 'put', 'patch', 'delete', 'head'];
|
||||
@@ -25,9 +26,9 @@ methods.forEach(method => {
|
||||
url,
|
||||
body = {},
|
||||
withCredentials = false,
|
||||
overriddenApiBase = apiBase,
|
||||
overriddenApiBase = API_BASE,
|
||||
} = (typeof data === 'string' ? { url: data } : data);
|
||||
const basename = `${baseUrl}${overriddenApiBase}`;
|
||||
const basename = `${BASE_URL}${overriddenApiBase}`;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const headers = {
|
||||
|
||||
Reference in New Issue
Block a user