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.
47 lines
792 B
47 lines
792 B
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<MatchInfo> => {
|
|
const config = {
|
|
body: {
|
|
params: {
|
|
_p_match_id: matchId,
|
|
_p_sport: sportId,
|
|
},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
return callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
}).then(getResponseData(proc))
|
|
}
|
|
|