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/getAds/getAds.tsx

52 lines
999 B

import { callApi } from 'helpers'
import { ADS_API_URL } from 'config'
import { DeviceType } from '../../components/Ads/types'
export type AdsParams = {
client_type: DeviceType,
language: string,
type_id: number,
}
export type AdType = {
'duration': number,
'frequency': number,
'id': number,
'impressions': number,
'link': string,
'media': {
url: string,
},
'name': string,
'position': {
'id': number,
'name_eng': string,
'name_rus': string,
'source_type': string,
},
remaining_views: number,
'time_close': number,
'type': {
'id': number,
'name_eng': string,
'name_rus': string,
},
}
export type PositionName = 'header' | 'block' | 'match_cell' | 'mobile'
export type AdResponse = Record<PositionName, AdsListType>
export type AdsListType = Array<AdType>
export const getAds = (params: AdsParams): Promise<AdResponse> => {
const config = {
body: params,
}
return callApi({
config,
url: ADS_API_URL,
})
}