1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-10-02 01:20:11 +02:00

fix: error when refresh token is expired

This commit is contained in:
Elias Schneider 2022-10-11 14:44:12 +02:00
parent 237733b53f
commit 0823d28e23

View File

@ -20,8 +20,8 @@ const signOut = () => {
};
const refreshAccessToken = async () => {
try {
const currentAccessToken = getCookie("access_token") as string;
if (
currentAccessToken &&
(jose.decodeJwt(currentAccessToken).exp ?? 0) * 1000 <
@ -32,6 +32,9 @@ const refreshAccessToken = async () => {
const response = await api.post("auth/token", { refreshToken });
setCookies("access_token", response.data.accessToken);
}
} catch {
console.info("Refresh token invalid or expired");
}
};
export default {