import { DATA_URL, PROCEDURES, SportTypes, } from 'config' import { callApi, getResponseData } from 'helpers' const proc = PROCEDURES.get_tournament_list type Country = { id: number, name_eng: string, name_rus: string, } export type Tournament = { country: Country, gender: number | null, id: number, name_eng: string, name_rus: string, short_name_eng: string | null, short_name_rus: string | null, sport: SportTypes, tournament_type: number, } export type Tournaments = Array export const getSportTournaments = ( sportId?: number | null, offset: number = 0, ): Promise => { const config = { body: { params: { _p_limit: 20, _p_offset: offset, _p_sport: sportId, }, proc, }, } return callApi({ config, url: DATA_URL, }).then(getResponseData(proc)) }