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.
 
 
 
 
spa_instat_tv/src/requests/getMatches/getHomeMatches.tsx

37 lines
790 B

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<MatchesBySection> => {
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)
}