diff --git a/ayanova/src/api/apiutil.js b/ayanova/src/api/apiutil.js index 670956f1..75b0224a 100644 --- a/ayanova/src/api/apiutil.js +++ b/ayanova/src/api/apiutil.js @@ -1,5 +1,7 @@ -/* eslint-disable */ +/* Xeslint-disable */ import store from "../store"; +import router from "../router"; +import auth from "./auth"; var stringifyPrimitive = function(v) { switch (typeof v) { @@ -21,7 +23,7 @@ export default { status(response) { //debugger; - if(response.status==401){ + if (response.status == 401) { //must reject if not authorized return Promise.reject(new Error("401 - NOT AUTHORIZED")); } @@ -107,7 +109,8 @@ export default { //construct the api url and store it //development location? if ( - (window.location.hostname == "localhost" || window.location.hostname == "192.168.1.56" ) && + (window.location.hostname == "localhost" || + window.location.hostname == "192.168.1.56") && window.location.port == "8080" ) { store.commit("setAPIURL", "http://localhost:7575/api/v8.0/"); @@ -181,12 +184,14 @@ export default { }) .catch(function(error) { //fundamental error, can't proceed with this call - // debugger; + // debugger; var errorMessage = "API error: GET route =" + route + ", message =" + error.message; store.commit("logItem", errorMessage); alert("Error: " + errorMessage); reject(error); + auth.logout(); + router.push("/login"); }); }); }