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

View File

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