diff --git a/ui/src/api/api.tsx b/ui/src/api/api.tsx
index b6eb12a75..167bd05ee 100644
--- a/ui/src/api/api.tsx
+++ b/ui/src/api/api.tsx
@@ -212,11 +212,25 @@ export const getIdToken = async (
export const authAxios = async (msalInstance: PublicClientApplication) => {
const token = await getIdToken(msalInstance);
- return Axios.create({
+ const axios = Axios.create({
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
baseURL: getApiBaseUrl(),
});
+
+ axios.interceptors.response.use(
+ (response) => {
+ return response;
+ },
+ (error) => {
+ if (error.response?.status === 403) {
+ const detail = error.response.data.detail;
+ window.location.href = "/responseErrors/403/" + detail;
+ }
+ //TODO: handle other response errors
+ }
+ );
+ return axios;
};
diff --git a/ui/src/app.tsx b/ui/src/app.tsx
index d79960859..66a09574a 100644
--- a/ui/src/app.tsx
+++ b/ui/src/app.tsx
@@ -14,6 +14,7 @@ import Jobs from "./pages/jobs/jobs";
import Monitoring from "./pages/monitoring/monitoring";
import LineageGraph from "./pages/feature/lineageGraph";
import Management from "./pages/management/management";
+import ResponseErrors from "./pages/responseErrors/responseErrors";
import RoleManagement from "./pages/management/roleManagement";
import { getMsalConfig } from "./utils/utils";
@@ -46,6 +47,10 @@ const App: React.FC = () => {