import { PROCEDURES, API_ROOT } from 'config' import { client } from 'config/clients' import type { MatchesBySection } from './types' import { requestMatches } from './request' import { getMatchesPreviews } from './getPreviews' const proc = PROCEDURES.get_matches type Args = { date: string, limit: number, offset: number, timezoneOffset: number, } export const getHomeMatches = async ({ date, limit, offset, timezoneOffset, }: Args): Promise => { const url = `${API_ROOT}/v1/data/get-matches` const config = { body: { _p_date: `${date} 00:00:00`, _p_gmt: timezoneOffset, _p_limit: limit, _p_offset: offset, ...client.requests?.[proc], }, } return requestMatches(config, url).then(getMatchesPreviews) }