use-shopify
Version:
React hooks to work with Shopify's Storefront API
39 lines (38 loc) • 1.22 kB
TypeScript
import { SearchState } from './useSearch';
import { SearchQueryResult } from './searchQuery';
export declare const NEW_SEARCH = "NEW_SEARCH";
export declare const SET_SEARCH_TERM = "SET_SEARCH_TERM";
export declare const FETCH_MORE = "FETCH_MORE";
export declare const FETCHED_RESULTS = "FETCHED_RESULTS";
export declare const RESET = "RESET";
interface NewSearchAction {
type: typeof NEW_SEARCH;
searchTerm?: string;
}
interface FetchMoreAction {
type: typeof FETCH_MORE;
}
interface FetchedResultsAction {
type: typeof FETCHED_RESULTS;
results: SearchQueryResult;
}
interface SetSearchTermAction {
type: typeof SET_SEARCH_TERM;
searchTerm: string;
}
interface ResetAction {
type: typeof RESET;
}
declare type Action = NewSearchAction | FetchMoreAction | FetchedResultsAction | SetSearchTermAction | ResetAction;
export declare const initialState: {
searchTerm: string;
loading: boolean;
results: never[];
products: never[];
collections: never[];
hasMoreResults: boolean;
stale: boolean;
lastSearchTerm: undefined;
};
export declare const reducer: (state: SearchState, action: Action) => SearchState;
export {};