Instanciate API/PopUp in common

This commit is contained in:
xdrm-brackets 2018-02-20 22:57:39 +01:00
parent 4c7a9cfa9b
commit 2bc265efb0
1 changed files with 9 additions and 0 deletions

View File

@ -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
---------------------------------------------------------*/