Merge pull request 'fix(#2628): change route for getmatches and fix requestmatches' (#5) from OTT-2628-route-get-matches into develop

Reviewed-on: https://gitea.instat.tv/InStat/spa_instat_tv/pulls/5
keep-around/c565ff1b550717786d8ee4b348e0fa82262be550
andrey.dekterev 3 years ago
commit c565ff1b55
  1. 6
      src/requests/getMatches/getHomeMatches.tsx
  2. 6
      src/requests/getMatches/request.tsx

@ -1,4 +1,4 @@
import { PROCEDURES } from 'config'
import { PROCEDURES, API_ROOT } from 'config'
import { client } from 'config/clients'
@ -21,6 +21,8 @@ export const getHomeMatches = async ({
offset,
timezoneOffset,
}: Args): Promise<MatchesBySection> => {
const url = `${API_ROOT}/v1/data/get-matches`
const config = {
body: {
_p_date: `${date} 00:00:00`,
@ -31,5 +33,5 @@ export const getHomeMatches = async ({
},
}
return requestMatches(config).then(getMatchesPreviews)
return requestMatches(config, url).then(getMatchesPreviews)
}

@ -1,4 +1,4 @@
import { API_ROOT } from 'config'
import { DATA_URL } from 'config'
import { callApi } from 'helpers'
import type { MatchesResponse, MatchesBySection } from './types'
@ -9,14 +9,14 @@ type Config = {
},
}
export const requestMatches = async (config: Config): Promise<MatchesBySection> => {
export const requestMatches = async (config: Config, url?: string): Promise<MatchesBySection> => {
const {
is_video_sections,
show,
video_content: data,
}: MatchesResponse = await callApi({
config,
url: `${API_ROOT}/v1/data/get-matches`,
url: url || DATA_URL,
})
return {

Loading…
Cancel
Save