in app/interceptors.ts [13:55]
function setupInterceptors() {
axios.defaults.baseURL = deploymentRootPath;
axios.interceptors.request.use((config) => {
const token = window.localStorage.getItem("pluto:access-token");
if (token) config.headers.Authorization = `Bearer ${token}`;
if (
config.url?.startsWith("/deliverables") ||
config.url?.startsWith("/pluto-core")
) {
config.baseURL = undefined;
}
return config;
});
axios.interceptors.response.use(
(response) => response,
(error: AxiosError) => {
if (error.response) {
switch (error.response.status) {
case 502 | 503 | 504:
SystemNotification.open(
SystemNotifcationKind.Error,
"Vidispine is not responding, please report this to multimedia tech and try again in a few minutes"
);
break;
default:
break;
}
} else if (error.name) {
if (error.name == "NetworkError") {
SystemNotification.open(
SystemNotifcationKind.Error,
"Vidispine is not responding, please report this to multimedia tech and try again in a few minutes"
);
}
} else {
console.error("got error of ", error);
}
throw error;
}
);
}