fix(#in261): future mathces click disabled for virt user #74

Merged
andrey.dekterev merged 1 commits from IN-261-futurematch-click-disable into develop 3 years ago
  1. 6
      src/features/Matches/helpers/getMatchClickAction/index.tsx

@ -1,6 +1,7 @@
import type { Match } from 'requests'
import type { User } from 'oidc-client'
import { isFuture } from 'date-fns'
export enum MatchAccess {
CanBuyMatch = 'CanBuyMatch',
@ -21,7 +22,12 @@ export const getMatchAccess = (match: Match, user: User | undefined) => {
const dateToMs = Date.parse(date?.replace(/ /, 'T')) // без замены не будет работать в сафари
const dateNowMin10 = dateToMs - 10 * 60 * 1000
const matchDate = new Date(date)
const isFutureDate = isFuture(matchDate)
switch (true) {
case !user && isFutureDate:
return MatchAccess.NoAccess
case !user:
return MatchAccess.ViewMatchPopupWithoutUser
case !sub:

Loading…
Cancel
Save