import { DATA_URL, PROCEDURES, } from 'config' import { callApi, getResponseData } from 'helpers' import { MatchStatuses } from 'features/HeaderFilters' const proc = PROCEDURES.get_match_info type Team = { id: number, name_eng: string, name_rus: string, score: number, } export type MatchInfo = { date: Date, stream_status: MatchStatuses, team1: Team, team2: Team, tournament: { id: number, name_eng: string, name_rus: string, }, } | null export const getMatchInfo = (sportId: number, matchId: number) : Promise => { const config = { body: { params: { _p_match_id: matchId, _p_sport: sportId, }, proc, }, } return callApi({ config, url: DATA_URL, }).then(getResponseData(proc)) }