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
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue