This commit is contained in:
2020-04-05 20:38:08 +00:00
parent 8432ed62f7
commit d031f60285
4 changed files with 41 additions and 10 deletions

View File

@@ -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();
}

View File

@@ -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,