fix: small adjustment
Some checks are pending
Release / build (ubuntu-latest) (push) Waiting to run
Release / build (windows-latest) (push) Waiting to run

This commit is contained in:
Zamitto 2024-10-22 22:33:23 -03:00
parent c36c940a79
commit 73185e7cbc
2 changed files with 3 additions and 7 deletions

View File

@ -44,7 +44,7 @@ export class HydraApi {
return this.userAuth.authToken !== "";
}
private static hasCloudSubscription() {
private static hasActiveSubscription() {
return (
this.userAuth.subscription?.expiresAt &&
this.userAuth.subscription.expiresAt > new Date()
@ -279,7 +279,7 @@ export class HydraApi {
}
if (needsSubscription) {
if (!(await this.hasCloudSubscription())) {
if (!(await this.hasActiveSubscription())) {
throw new SubscriptionRequiredError();
}
}

View File

@ -128,12 +128,8 @@ export function useUserDetails() {
const unblockUser = (userId: string) => window.electron.unblockUser(userId);
const hasActiveSubscription = useMemo(() => {
if (!userDetails?.subscription?.plan) {
return false;
}
return (
userDetails.subscription.expiresAt &&
userDetails?.subscription?.expiresAt &&
new Date(userDetails.subscription.expiresAt) > new Date()
);
}, [userDetails]);