🐛 fix(API/index.ts): add condition to check if token exists before making the request to renew access token to prevent errors

This commit is contained in:
Cristhian Zanforlin Lousa 2023-09-11 09:08:32 -03:00
commit b832e0844e

View file

@ -393,7 +393,9 @@ export async function autoLogin() {
export async function renewAccessToken(token: string) { export async function renewAccessToken(token: string) {
try { try {
return await api.post(`${BASE_URL_API}refresh?token=${token}`); if (token) {
return await api.post(`${BASE_URL_API}refresh?token=${token}`);
}
} catch (error) { } catch (error) {
console.log("Error:", error); console.log("Error:", error);
throw error; throw error;