Skip to content

Commit

Permalink
add search result to biggy client (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiagolcm authored and chrsmutti committed Nov 25, 2019
1 parent 63949a6 commit d05bf68
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions react/utils/biggy-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getCookie, setCookie } from "./dom-utils";
import suggestionProducts from "../graphql/suggestionProducts.gql";
import suggestionSearches from "../graphql/suggestionSearches.gql";
import topSearches from "../graphql/topSearches.gql";
import searchResult from "../graphql/searchResult.gql";

export default class BiggyClient {
private historyKey = "biggy-search-history";
Expand Down Expand Up @@ -73,6 +74,31 @@ export default class BiggyClient {

setCookie(this.historyKey, history.join(","));
}

async searchResult(
store: string,
attributePath: string,
query: string,
page: number,
sort?: string,
count?: number,
operator?: string,
fuzzy?: string,
) {
return this.client.query({
query: searchResult,
variables: {
store,
attributePath,
query,
page,
sort,
count,
operator,
fuzzy,
},
});
}
}

interface ISearchesOutput {
Expand Down

0 comments on commit d05bf68

Please sign in to comment.