Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: error should be passed down to the caller, NOT be negelected in the interceptor (#274)
Luke Zhou60ce4c1f7bd4
diff --git a/frontend/src/main.ts b/frontend/src/main.tsindex 2584c84d93..e7678efdf3 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -62,7 +62,7 @@ axios.interceptors.response.use(}return response;},- (error) => {+ async (error) => {if (error.response) {// When receiving 401 and is returned by our server, it means the current// login user's token becomes invalid. Thus we force a logout.@@ -71,9 +71,11 @@ axios.interceptors.response.use(if (error.response.status == 401) {const host = store.getters["actuator/info"]().host;if (error.response.request.responseURL.startsWith(host))- store.dispatch("auth/logout").then(() => {+ try {+ await store.dispatch("auth/logout");+ } finally {router.push({ name: "auth.signin" });- });+ }}if (error.response.data.message) {@@ -83,14 +85,12 @@ axios.interceptors.response.use(title: error.response.data.message,});}- return;} else if (error.code == "ECONNABORTED") {store.dispatch("notification/pushNotification", {module: "bytebase",style: "CRITICAL",title: "Connecting server timeout. Make sure the server is running.",});- return;}throw error;diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.tsindex 1a77928162..9e986a19d0 100644--- a/frontend/src/store/modules/auth.ts+++ b/frontend/src/store/modules/auth.ts@@ -50,9 +50,11 @@ const actions = {},async logout({ commit }: any) {- await axios.post("/api/auth/logout");-- commit("setCurrentUser", unknown("PRINCIPAL") as Principal);+ try {+ await axios.post("/api/auth/logout");+ } finally {+ commit("setCurrentUser", unknown("PRINCIPAL") as Principal);+ }return unknown("PRINCIPAL") as Principal;},