You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
707 B
39 lines
707 B
import map from 'lodash/map'
|
|
|
|
import format from 'date-fns/format'
|
|
|
|
import type { Match } from 'requests'
|
|
import { getSportLexic } from 'helpers'
|
|
|
|
const prepareMatch = ({
|
|
access,
|
|
date,
|
|
has_video,
|
|
id,
|
|
preview,
|
|
sport,
|
|
stream_status,
|
|
sub,
|
|
team1,
|
|
team2,
|
|
tournament,
|
|
}: Match) => ({
|
|
accessibleBySubscription: sub,
|
|
accessibleInUsersCountry: access,
|
|
date: format(new Date(date), 'dd.MM.yy'),
|
|
hasVideo: has_video,
|
|
id,
|
|
preview,
|
|
sportName: getSportLexic(sport),
|
|
sportType: sport,
|
|
streamStatus: stream_status,
|
|
team1,
|
|
team2,
|
|
time: format(new Date(date), 'HH:mm'),
|
|
tournament,
|
|
})
|
|
|
|
export const prepareMatches = (matches: Array<Match>) => map(
|
|
matches,
|
|
prepareMatch,
|
|
)
|
|
|