|
|
@@ -16,8 +16,10 @@ const API = (() => {
|
|
|
|
|
|
const res = await fetch(url, opts);
|
|
|
if (res.status === 401) {
|
|
|
- localStorage.removeItem('token');
|
|
|
- window.location.reload();
|
|
|
+ if (getToken()) {
|
|
|
+ localStorage.removeItem('token');
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
throw new Error('Unauthorized');
|
|
|
}
|
|
|
|