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.
57 lines
1.1 KiB
57 lines
1.1 KiB
import {
|
|
DATA_URL,
|
|
PROCEDURES,
|
|
ProfileTypes,
|
|
} from 'config'
|
|
import { callApi } from 'helpers'
|
|
|
|
const proc = PROCEDURES.get_user_favorites
|
|
|
|
type ObjectWithName = {
|
|
id: number,
|
|
name_eng: string,
|
|
name_rus: string,
|
|
}
|
|
|
|
export type Info = {
|
|
country?: ObjectWithName,
|
|
date?: string,
|
|
firstname_eng?: string,
|
|
firstname_rus?: string,
|
|
lastname_eng?: string,
|
|
lastname_rus?: string,
|
|
name_eng?: string,
|
|
name_rus?: string,
|
|
nickname_eng?: string,
|
|
nickname_rus?: string,
|
|
short_name_eng?: string,
|
|
short_name_rus?: string,
|
|
/** информация о супертурнире, если турнир входит в супертурнир */
|
|
super_tournament?: ObjectWithName,
|
|
team?: ObjectWithName,
|
|
team1?: ObjectWithName,
|
|
team2?: ObjectWithName,
|
|
}
|
|
|
|
export type UserFavorite = {
|
|
id: number,
|
|
info: Info,
|
|
sport: number,
|
|
type: ProfileTypes,
|
|
}
|
|
|
|
export type UserFavorites = Array<UserFavorite>
|
|
|
|
export const getUserFavorites = (): Promise<UserFavorites> => {
|
|
const config = {
|
|
body: {
|
|
params: {},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
return callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
})
|
|
}
|
|
|