UI: suppress API error toasts during restart (#32265)
This commit is contained in:
parent
a3b14bb08f
commit
03a8c744d0
1 changed files with 6 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import axios, { type AxiosResponse } from "axios";
|
||||
import { openLoginModal } from "./components/Auth/auth";
|
||||
import restart from "./restart";
|
||||
|
||||
const { protocol, hostname, port, pathname } = window.location;
|
||||
|
||||
|
|
@ -29,6 +30,11 @@ const api = axios.create({
|
|||
});
|
||||
|
||||
const errorInterceptor = (error: any) => {
|
||||
// backend is expected to be unreachable during restart, don't alert
|
||||
if (restart.restarting) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
// handle unauthorized errors
|
||||
if (error.response?.status === 401) {
|
||||
openLoginModal();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue