This commit is contained in:
@@ -121,10 +121,20 @@ export default {
|
|||||||
return Promise.resolve(response);
|
return Promise.resolve(response);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
statusEx(response) {
|
statusEx(response, isLogin = false) {
|
||||||
//Handle expected api errors
|
//Handle expected api errors
|
||||||
if (response.status == 401) {
|
if (response.status == 401) {
|
||||||
throw new Error("LT:ErrorUserNotAuthenticated");
|
if (!isLogin) {
|
||||||
|
throw new Error("LT:ErrorUserNotAuthenticated");
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
response.statusText.includes("License agreement consent required")
|
||||||
|
) {
|
||||||
|
throw new Error(response.statusText);
|
||||||
|
} else {
|
||||||
|
throw new Error("LT:ErrorUserNotAuthenticated"); //bad login or password
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.status == 403) {
|
if (response.status == 403) {
|
||||||
@@ -455,7 +465,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let r = await fetch(that.APIUrl(route), fetchOptions);
|
let r = await fetch(that.APIUrl(route), fetchOptions);
|
||||||
that.statusEx(r);
|
that.statusEx(r, isLogin);
|
||||||
r = await that.extractBodyEx(r);
|
r = await that.extractBodyEx(r);
|
||||||
return r;
|
return r;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -531,7 +531,6 @@ export default {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
console.log(res.error);
|
|
||||||
//don't expect this to ever get called but just in case
|
//don't expect this to ever get called but just in case
|
||||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||||
}
|
}
|
||||||
@@ -551,6 +550,12 @@ export default {
|
|||||||
|
|
||||||
await this.step2(res);
|
await this.step2(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (
|
||||||
|
error.message &&
|
||||||
|
error.message.includes("License agreement consent required")
|
||||||
|
) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
//bad creds?
|
//bad creds?
|
||||||
if (
|
if (
|
||||||
error.message &&
|
error.message &&
|
||||||
@@ -567,6 +572,7 @@ export default {
|
|||||||
//probably here because server unresponsive.
|
//probably here because server unresponsive.
|
||||||
if (error.message) {
|
if (error.message) {
|
||||||
let msg = error.message;
|
let msg = error.message;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
msg.includes("NetworkError") ||
|
msg.includes("NetworkError") ||
|
||||||
msg.includes("Failed to fetch")
|
msg.includes("Failed to fetch")
|
||||||
|
|||||||
Reference in New Issue
Block a user