Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: handle auth errors (#10442)
boojack04ba90060af5
diff --git a/frontend/src/App.vue b/frontend/src/App.vueindex 1e790694f7..4afa871752 100644--- a/frontend/src/App.vue+++ b/frontend/src/App.vue@@ -72,15 +72,8 @@ onErrorCaptured((error: any /* , _, info */) => {(error instanceof ServerError || error instanceof ClientError) &&Object.values(Status).includes(error.code)) {- notificationStore.pushNotification({- module: "bytebase",- style: "CRITICAL",- title: `Request error occurred`,- description: error.details,- });+ // Ignored: we will handle request errors in the error handler middleware of nice-grpc-web.} else if (!error.response) {- // If error has response, then we assume it's an http error and has already been- // handled by the axios global handler.notificationStore.pushNotification({module: "bytebase",style: "CRITICAL",diff --git a/frontend/src/grpcweb/middlewares/authInterceptorMiddleware.ts b/frontend/src/grpcweb/middlewares/authInterceptorMiddleware.tsindex caec0dec1b..8f43a9a2fc 100644--- a/frontend/src/grpcweb/middlewares/authInterceptorMiddleware.ts+++ b/frontend/src/grpcweb/middlewares/authInterceptorMiddleware.ts@@ -27,13 +27,16 @@ export type IgnoreErrorsOptions = {export const authInterceptorMiddleware: ClientMiddleware<IgnoreErrorsOptions> =async function* (call, options) {const handleError = async (error: unknown) => {- if (error instanceof ClientError || error instanceof ServerError) {+ // If silent is set to true, will NOT show redirect to other pages(e.g., 403, sign in page).+ if (+ !options.silent &&+ (error instanceof ClientError || error instanceof ServerError)+ ) {const { code } = error;if (options.ignoredCodes?.includes(code)) {// omit specified errors} else {if (code === Status.UNAUTHENTICATED) {- if (options.silent) return;// "Kick out" sign in status if access token expires.try {await useAuthStore().logout();@@ -41,7 +44,6 @@ export const authInterceptorMiddleware: ClientMiddleware<IgnoreErrorsOptions> =router.push({ name: AUTH_SIGNIN_MODULE });}} else if (code === Status.PERMISSION_DENIED) {- if (options.silent) return;// Jump to 403 pagerouter.push({ name: "error.403" });}