mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: subscription date validation
This commit is contained in:
parent
ee4639e041
commit
730ea4f2b9
5 changed files with 7 additions and 56 deletions
|
@ -12,6 +12,7 @@ import { UserNotLoggedInError, SubscriptionRequiredError } from "@shared";
|
|||
import { omit } from "lodash-es";
|
||||
import { appVersion } from "@main/constants";
|
||||
import { getUserData } from "./user/get-user-data";
|
||||
import { isFuture, isToday } from "date-fns";
|
||||
|
||||
interface HydraApiOptions {
|
||||
needsAuth?: boolean;
|
||||
|
@ -45,10 +46,8 @@ export class HydraApi {
|
|||
}
|
||||
|
||||
private static hasActiveSubscription() {
|
||||
return (
|
||||
this.userAuth.subscription?.expiresAt &&
|
||||
this.userAuth.subscription.expiresAt > new Date()
|
||||
);
|
||||
const expiresAt = this.userAuth.subscription?.expiresAt;
|
||||
return expiresAt && (isFuture(expiresAt) || isToday(expiresAt));
|
||||
}
|
||||
|
||||
static async handleExternalAuth(uri: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue