Skip to content

Commit dfac4da

Browse files
committed
fix: update key storage method and add delay before redirecting on network errors
1 parent df01f2e commit dfac4da

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

client/src/components/key/KeyAccessModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function KeyAccessModal({ openAccess, setOpenAccess }) {
2727
const formJson = Object.fromEntries(formData.entries());
2828
formJson.key = btoa(formJson.key);
2929
const response = await http.post('/pin/verify', formJson);
30-
localStorage.setItem("eKey", btoa(formJson.key));
30+
localStorage.setItem("eKey", formJson.key);
3131
toast.success(response.data.message);
3232
setOpenAccess(!openAccess);
3333
}

client/src/middleware/AuthProvider.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ http.interceptors.response.use(
2727
(error) => {
2828
if (!error.response && error.message === "Network Error") {
2929
localStorage.clear();
30-
window.location.href = "/503";
30+
setTimeout(() => { window.location.href = "/503"; }, 2000);
3131
}
32-
if (error.response.status === 401 && error.response.data.message === "Unauthorized") {
32+
if (error.response.status === 401) {
3333
localStorage.clear();
34-
window.location.href = "/";
34+
setTimeout(() => { window.location.href = "/"; }, 2000);
3535
}
3636
return Promise.reject(error);
3737
}

0 commit comments

Comments
 (0)