Uprava error stranek, indexu

This commit is contained in:
Michal Kváček
2023-12-19 20:34:06 +01:00
parent 9aebc352cd
commit 966d582b63
28 changed files with 100 additions and 62 deletions
+7 -5
View File
@@ -55,9 +55,7 @@ export default (({store, router}) => {
if (graphQLErrors) {
for (const error of graphQLErrors) {
if (error.message === "Not found") {
useAppStore(store).appStatus = 404;
} else if (error.message.includes("401") || error.message.includes("Not authorized")) {
if (error.message.includes("401") || error.message.includes("Not authorized")) {
return handleRefreshToken(store, router, forward, operation);
} else {
Notify.create(errorObject("API error: " + error.message));
@@ -78,9 +76,13 @@ export default (({store, router}) => {
})
.then((response) => response)
.catch(err => {
if (!err.toString().includes("401") && !err.toString().includes("Not authorized"))
const errStr = err.toString();
if (errStr.includes('Not found')) {
useAppStore(store).appStatus = 404;
}
else if (!errStr.includes("401") && !errStr.includes("Not authorized"))
console.error("Error during query: ", err)
return err;
return Promise.reject(err);
})
};
apolloWrapper.mutate = (mutation, variables) => {