From 778984239b5e51d47bdb043813f5d8607c4918af Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 27 Mar 2018 14:10:00 +0200 Subject: [PATCH] [setup][page.noauth.login] added API/WS instances + defined urls --- webpack/page/noauth/login.js | 7 ++----- webpack/setup.js | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/webpack/page/noauth/login.js b/webpack/page/noauth/login.js index c746844..423610f 100644 --- a/webpack/page/noauth/login.js +++ b/webpack/page/noauth/login.js @@ -107,10 +107,7 @@ gs.get.login.func.login = function(){ if( errors ) return false; - /* (3) Create API instance */ - let api = new xhrcd('douscord-srv.xdrm.io'); - - /* (4) API bindings */ + /* (3) API bindings */ api.onreceive = function(_response){ // manage error @@ -125,7 +122,7 @@ gs.get.login.func.login = function(){ api.onclose = function(){ return gs.get.router.push('register'); }; - /* (5) API call */ + /* (4) API call */ api.send({ path: 'POST /user/token', http_token: encodeURI(`${username}:${password}`) diff --git a/webpack/setup.js b/webpack/setup.js index 0d2549d..c110aa2 100644 --- a/webpack/setup.js +++ b/webpack/setup.js @@ -22,6 +22,10 @@ window.auth = new Authentication(); window.xhrcd = XHRClientDriver; window.wscd = WebSocketClientDriver; +/* (4) ClientDriver instances */ +window.api = new XHRClientDriver('api.douscord.xdrm.io'); +window.ws = new WebSocketClientDriver('ws.douscord.xdrm.io'); + /* (2) Global data