diff --git a/web/app/common/constants.js b/web/app/common/constants.js new file mode 100644 index 00000000..b8250aee --- /dev/null +++ b/web/app/common/constants.js @@ -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, +}; diff --git a/web/app/common/fetcher.js b/web/app/common/fetcher.js index 23e03ec7..675384f6 100644 --- a/web/app/common/fetcher.js +++ b/web/app/common/fetcher.js @@ -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 = { diff --git a/web/app/components/root/root.jsx b/web/app/components/root/root.jsx index b6e2bb87..09c1cf99 100644 --- a/web/app/components/root/root.jsx +++ b/web/app/components/root/root.jsx @@ -1,7 +1,8 @@ import { h, Component } from 'preact'; import api from 'common/api'; -import { baseUrl, url, id } from 'common/settings'; +import { BASE_URL, NODE_ID } from 'common/constants'; +import { url } from 'common/settings'; import store from 'common/store'; import AuthPanel from 'components/auth-panel'; @@ -54,7 +55,7 @@ export default class Root extends Component { } onSignIn(provider) { - const newWindow = window.open(`${baseUrl}/auth/${provider}/login?from=${encodeURIComponent(location.href)}`); + const newWindow = window.open(`${BASE_URL}/auth/${provider}/login?from=${encodeURIComponent(location.href)}`); let secondsPass = 0; const checkMsDelay = 200; @@ -89,7 +90,7 @@ export default class Root extends Component { render({}, { config = {}, comments = [], user, loaded }) { if (!loaded) { return ( -
+
); @@ -99,8 +100,8 @@ export default class Root extends Component { const pinnedComments = store.getPinnedComments(); return ( -
-
+
+
1%'] }), require('postcss-url')({ url: 'inline', maxSize: 5 }), - require('postcss-wrap')({ selector: `#${id}` }), + require('postcss-wrap')({ selector: `#${NODE_ID}` }), require('postcss-csso'), ] }