reload the window on 401

This commit is contained in:
Blake Blackshear 2024-05-04 07:21:28 -05:00
parent a70dd02788
commit c708953342

View File

@ -24,6 +24,11 @@ export function ApiProvider({ children, options }: ApiProviderType) {
const [path, params] = Array.isArray(key) ? key : [key, undefined]; const [path, params] = Array.isArray(key) ? key : [key, undefined];
return axios.get(path, { params }).then((res) => res.data); return axios.get(path, { params }).then((res) => res.data);
}, },
onError: (error, _key) => {
if (error.status === 401) {
window.location.reload();
}
},
...options, ...options,
}} }}
> >