delete user auth if it is not logged in

This commit is contained in:
Zamitto 2024-06-18 23:15:16 -03:00
parent 944f3891bf
commit 2c9129c7b6

View File

@ -100,7 +100,10 @@ export class HydraApi {
}
private static async revalidateAccessTokenIfExpired() {
if (!this.userAuth.authToken) throw new Error("user is not logged in");
if (!this.userAuth.authToken) {
userAuthRepository.delete({ id: 1 });
throw new Error("user is not logged in");
}
const now = new Date();
if (this.userAuth.expirationTimestamp < now.getTime()) {