File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ import { Ad } from '../types'
55
66const getAd = async (
77 keywords : string [ ] ,
8+ feed : boolean = false ,
89 aditionalAdQueries : { [ key : string ] : string } | undefined
910) : Promise < Ad | null > => {
10- let params = { keywords : keywords . join ( ',' ) }
11+ let params = { keywords : keywords . join ( ',' ) , feed : feed ? 'true' : 'false' }
1112 if ( aditionalAdQueries ) {
1213 params = { ...params , ...aditionalAdQueries }
1314 }
@@ -18,13 +19,14 @@ type QueryFnType = typeof getAd
1819
1920type UseGetAdOptions = {
2021 keywords : string [ ]
22+ feed ?: boolean
2123 config ?: QueryConfig < QueryFnType >
2224 aditionalAdQueries : { [ key : string ] : string } | undefined
2325}
24- export const useGetAd = ( { keywords, config, aditionalAdQueries } : UseGetAdOptions ) => {
26+ export const useGetAd = ( { keywords, feed , config, aditionalAdQueries } : UseGetAdOptions ) => {
2527 return useQuery < ExtractFnReturnType < QueryFnType > > ( {
2628 ...config ,
2729 queryKey : [ 'ad' , keywords . join ( ',' ) ] ,
28- queryFn : ( ) => getAd ( keywords , aditionalAdQueries ) ,
30+ queryFn : ( ) => getAd ( keywords , feed , aditionalAdQueries ) ,
2931 } )
3032}
You can’t perform that action at this time.
0 commit comments