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.
49 lines
880 B
49 lines
880 B
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<Tournament>
|
|
|
|
export const getSportTournaments = (
|
|
sportId?: number | null,
|
|
offset: number = 0,
|
|
): Promise<Tournaments> => {
|
|
const config = {
|
|
body: {
|
|
params: {
|
|
_p_limit: 20,
|
|
_p_offset: offset,
|
|
_p_sport: sportId,
|
|
},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
return callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
}).then(getResponseData(proc))
|
|
}
|
|
|