From d031f602854796ee4a18e10c9ee65fc8899d8f3f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 5 Apr 2020 20:38:08 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 4 +++- ayanova/src/api/authutil.js | 15 +++++++++++++-- ayanova/src/api/translation.js | 1 + ayanova/src/views/login.vue | 31 ++++++++++++++++++++++++------- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index ce878c42..f188a430 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -49,8 +49,10 @@ CURRENT TODOs @@@@@@@@@@@ ROADMAP STAGE 2: +todo: server state + - check server routes, what do they do to take into account server state -todo: SERVER STATUS +todo: SERVER STATE - check server status on attempt to login for first time or whatever, it should give a prominent warning if the server is unavailable due to closed for maint or whatever rather than just timing out. - Also it allows login which is good but it should restrict the UI if it's a fresh login to a closed server rather than just failing to do certain things - Maybe overall testing is needed with a closed server just to suss out what to do in the UI for that, we want ops people and admins in there but not other biz users if it's locked out diff --git a/ayanova/src/api/authutil.js b/ayanova/src/api/authutil.js index f7a22b8a..749fe2e3 100644 --- a/ayanova/src/api/authutil.js +++ b/ayanova/src/api/authutil.js @@ -4,11 +4,22 @@ import initialize from "./initialize"; export function processLogin(response) { return new Promise(function(resolve, reject) { + //check there is a response of some kind + if (!response) { + window.$gz.store.commit("logItem", "auth::processLogin -> no response"); + return reject(); + } + + //is there an error? + if (response.error) { + return reject(response.error); + } + //is token present? - if (!response || !response.data || !response.data.token) { + if (!response.data || !response.data.token) { window.$gz.store.commit( "logItem", - "auth::processLogin -> response empty" + "auth::processLogin -> response contains no data" ); return reject(); } diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index 451ed651..1d5dc1b2 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -35,6 +35,7 @@ export default { ) .then(window.$gz.api.status) .then(window.$gz.api.json) + // eslint-disable-next-line .then((response) => { window.$gz._.forEach( response.data, diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index a0719e8f..903e70cc 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -11,6 +11,9 @@ + + +