@@ -3,15 +3,8 @@ import { axios } from 'src/lib/axios'
33import { ExtractFnReturnType , QueryConfig } from 'src/lib/react-query'
44import { Ad } from '../types'
55
6- const getAd = async (
7- keywords : string [ ] ,
8- feed : boolean = false ,
9- aditionalAdQueries : { [ key : string ] : string } | undefined
10- ) : Promise < Ad | null > => {
6+ const getAd = async ( keywords : string [ ] , feed : boolean = false ) : Promise < Ad | null > => {
117 let params = { keywords : keywords . join ( ',' ) , feed : feed ? 'true' : 'false' }
12- if ( aditionalAdQueries ) {
13- params = { ...params , ...aditionalAdQueries }
14- }
158 return axios . get ( '/engine/ads/' , { params } )
169}
1710
@@ -21,12 +14,11 @@ type UseGetAdOptions = {
2114 keywords : string [ ]
2215 feed ?: boolean
2316 config ?: QueryConfig < QueryFnType >
24- aditionalAdQueries : { [ key : string ] : string } | undefined
2517}
26- export const useGetAd = ( { keywords, feed, config, aditionalAdQueries } : UseGetAdOptions ) => {
18+ export const useGetAd = ( { keywords, feed, config } : UseGetAdOptions ) => {
2719 return useQuery < ExtractFnReturnType < QueryFnType > > ( {
2820 ...config ,
2921 queryKey : [ 'ad' , keywords . join ( ',' ) ] ,
30- queryFn : ( ) => getAd ( keywords , feed , aditionalAdQueries ) ,
22+ queryFn : ( ) => getAd ( keywords , feed ) ,
3123 } )
3224}
0 commit comments