mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-19 17:23:57 +00:00
fix: subscription date validation
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
UserDetails,
|
||||
} from "@types";
|
||||
import { UserFriendModalTab } from "@renderer/pages/shared-modals/user-friend-modal";
|
||||
import { isFuture, isToday } from "date-fns";
|
||||
|
||||
export function useUserDetails() {
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -128,10 +129,8 @@ export function useUserDetails() {
|
||||
const unblockUser = (userId: string) => window.electron.unblockUser(userId);
|
||||
|
||||
const hasActiveSubscription = useMemo(() => {
|
||||
return (
|
||||
userDetails?.subscription?.expiresAt &&
|
||||
new Date(userDetails.subscription.expiresAt) > new Date()
|
||||
);
|
||||
const expiresAt = userDetails?.subscription?.expiresAt;
|
||||
return expiresAt && (isFuture(expiresAt) || isToday(expiresAt));
|
||||
}, [userDetails]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -75,7 +75,7 @@ export function CloudSyncFilesModal({
|
||||
showSuccessToast(t("custom_backup_location_set"));
|
||||
getGameBackupPreview();
|
||||
}
|
||||
}, [objectId, setValue, shop, showSuccessToast, getGameBackupPreview]);
|
||||
}, [objectId, setValue, shop, showSuccessToast, getGameBackupPreview, t]);
|
||||
|
||||
const handleFileMappingMethodClick = useCallback(
|
||||
(mappingOption: FileMappingMethod) => {
|
||||
|
||||
Reference in New Issue
Block a user