From 7cc89979f0a2883d929c77eddaebb2c787a97bd2 Mon Sep 17 00:00:00 2001 From: Domingos Panta Date: Thu, 12 May 2022 15:52:21 +0100 Subject: [PATCH] Moving change from axios interceptor to specific request. --- src/mixins/public.js | 11 ----------- src/pages/StatusPage.vue | 5 +++++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mixins/public.js b/src/mixins/public.js index b9a1470d9..a3e12f460 100644 --- a/src/mixins/public.js +++ b/src/mixins/public.js @@ -7,17 +7,6 @@ if (env === "development" || localStorage.dev === "dev") { axios.defaults.baseURL = location.protocol + "//" + location.hostname + ":3001"; } -// Add a response interceptor to catch 404 errors in dymanic routes such as /status/:slug -axios.interceptors.response.use(function (response) { - return response; -}, function (error) { - if (error.response.status === 404) { - location.href = "/page-not-found"; - } - console.log(error); - return Promise.reject(error); -}); - export default { data() { return { diff --git a/src/pages/StatusPage.vue b/src/pages/StatusPage.vue index 8cda7ebba..1c40016c3 100644 --- a/src/pages/StatusPage.vue +++ b/src/pages/StatusPage.vue @@ -551,6 +551,11 @@ export default { this.incident = res.data.incident; this.$root.publicGroupList = res.data.publicGroupList; + }).catch( function (error) { + if (error.response.status === 404) { + location.href = "/page-not-found"; + } + console.log(error); }); // 5mins a loop