import isUndefined from 'lodash/isUndefined' import { API_ROOT } from 'config' import { callApi } from 'helpers' type Tournaments = { season: string, season_id: number, sport_eng: string, sport_id: number, sport_rus: string, tournament_eng: string, tournament_id: number, tournament_rus: string, } type Teams = { id: number, logo: string, name_eng: string, name_rus: string, sport_id: number, } type Gallery = { id: string, url: string, } export type Landing = { button_color?: string, date_from: string, date_to: string, id: number, lexic_button?: number, lexic_description?: number, lexic_period?: number, lexic_title?: number, logo_insports: boolean, logo_team: boolean, media: { gallery: Array, logo: string, }, name: string, teams: Array, tournaments: Array | null, url_button?: string, } type Args = { landingName: number | string, seasonId?: number, sportId?: number, tournamentId?: number, } export const getLanding = async ({ landingName, seasonId, sportId, tournamentId, }: Args): Promise => { const config = { method: 'GET', } return callApi({ config, url: `${API_ROOT}/v1/landings/${landingName}${isUndefined(seasonId) ? '' : `?season_id=${seasonId}&sport_id=${sportId}&tournament_id=${tournamentId}`}`, }) }