Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Allow 0 params
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverJAsh committed Jul 15, 2021
1 parent 23f561f commit 9036e50
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/methods/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type SearchPhotosParams = SearchParams &
export const getPhotos = (() => {
const getPathname = () => `${SEARCH_PATH_PREFIX}/photos`;
return makeEndpoint({
getPathname,
// Wrapper uses type trick to allow 0 args
getPathname: (_params?: void) => getPathname(),
handleRequest: createRequestHandler(
({
query,
Expand Down Expand Up @@ -64,7 +65,8 @@ export const getPhotos = (() => {
export const getCollections = (() => {
const getPathname = () => `${SEARCH_PATH_PREFIX}/collections`;
return makeEndpoint({
getPathname,
// Wrapper uses type trick to allow 0 args
getPathname: (_params?: void) => getPathname(),
handleRequest: createRequestHandler(({ query, ...paginationParams }: SearchParams) => ({
pathname: getPathname(),
query: { query, ...Query.getFeedParams(paginationParams) },
Expand All @@ -76,7 +78,8 @@ export const getCollections = (() => {
export const getUsers = (() => {
const getPathname = () => `${SEARCH_PATH_PREFIX}/users`;
return makeEndpoint({
getPathname,
// Wrapper uses type trick to allow 0 args
getPathname: (_params?: void) => getPathname(),
handleRequest: createRequestHandler(({ query, ...paginationParams }: SearchParams) => ({
pathname: getPathname(),
query: { query, ...Query.getFeedParams(paginationParams) },
Expand Down

0 comments on commit 9036e50

Please sign in to comment.