mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-22 08:57:20 -06:00
guard clause for api error (#11436)
This commit is contained in:
parent
c1560308bf
commit
bca01cb43c
@ -25,7 +25,10 @@ export function ApiProvider({ children, options }: ApiProviderType) {
|
||||
return axios.get(path, { params }).then((res) => res.data);
|
||||
},
|
||||
onError: (error, _key) => {
|
||||
if ([401, 302, 307].includes(error.response.status)) {
|
||||
if (
|
||||
error.response &&
|
||||
[401, 302, 307].includes(error.response.status)
|
||||
) {
|
||||
window.location.href =
|
||||
error.response.headers.get("location") ?? "login";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user