This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
/* eslint-disable */
|
/* Xeslint-disable */
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
|
import router from "../router";
|
||||||
|
import auth from "./auth";
|
||||||
|
|
||||||
var stringifyPrimitive = function(v) {
|
var stringifyPrimitive = function(v) {
|
||||||
switch (typeof v) {
|
switch (typeof v) {
|
||||||
@@ -21,7 +23,7 @@ export default {
|
|||||||
status(response) {
|
status(response) {
|
||||||
//debugger;
|
//debugger;
|
||||||
|
|
||||||
if(response.status==401){
|
if (response.status == 401) {
|
||||||
//must reject if not authorized
|
//must reject if not authorized
|
||||||
return Promise.reject(new Error("401 - NOT AUTHORIZED"));
|
return Promise.reject(new Error("401 - NOT AUTHORIZED"));
|
||||||
}
|
}
|
||||||
@@ -107,7 +109,8 @@ export default {
|
|||||||
//construct the api url and store it
|
//construct the api url and store it
|
||||||
//development location?
|
//development location?
|
||||||
if (
|
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"
|
window.location.port == "8080"
|
||||||
) {
|
) {
|
||||||
store.commit("setAPIURL", "http://localhost:7575/api/v8.0/");
|
store.commit("setAPIURL", "http://localhost:7575/api/v8.0/");
|
||||||
@@ -181,12 +184,14 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
//fundamental error, can't proceed with this call
|
//fundamental error, can't proceed with this call
|
||||||
// debugger;
|
// debugger;
|
||||||
var errorMessage =
|
var errorMessage =
|
||||||
"API error: GET route =" + route + ", message =" + error.message;
|
"API error: GET route =" + route + ", message =" + error.message;
|
||||||
store.commit("logItem", errorMessage);
|
store.commit("logItem", errorMessage);
|
||||||
alert("Error: " + errorMessage);
|
alert("Error: " + errorMessage);
|
||||||
reject(error);
|
reject(error);
|
||||||
|
auth.logout();
|
||||||
|
router.push("/login");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user