From 2bc265efb08779fcba325b2d478fb0c3f6f18bac Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 20 Feb 2018 22:57:39 +0100 Subject: [PATCH] Instanciate API/PopUp in common --- webpack/data/common.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webpack/data/common.js b/webpack/data/common.js index 7505dc0..a83c0af 100644 --- a/webpack/data/common.js +++ b/webpack/data/common.js @@ -1,4 +1,6 @@ import {GlobalStore} from '../lib/gstore' +import {APIClient} from '../lib/api-client' +import {PopUp} from '../lib/pop-up' window.gstore = new GlobalStore(); @@ -11,6 +13,13 @@ gstore.add('URI', document.URL.replace(/^(?:\/\/|[^\/]+)*/, '').split('/').filte /* (2) Get if local version or prod */ gstore.add('is_local', document.URL.replace(/^https?:\/\/([^\/:]+).*$/, '$1') == 'ptut.com'); +/* (3) API instance */ +window.api = new APIClient(gstore.get.is_local ? 'http://ptut.com:8080/api/v/1.0/' : 'https://ptut.xdrm.io/api/v/1.0/'); + +/* (4) PopUp instance */ +window.popup = new PopUp(); + + /* (2) Main components ---------------------------------------------------------*/