Skip to content

Commit

Permalink
Search: update summary interface
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatanpham committed Apr 17, 2019
1 parent f4e8894 commit a844c55
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,14 @@ export interface PipelineProps {
summary: SummaryInterface | undefined;
}

export interface QueryValuesInterface {
filter: string;
q: string;
page: string;
}

export interface ValuesInterface {
q?: string;
"q.original"?: string;
"q.suggestions"?: string;
}

export interface ResponseInterface {
reads: number;
totalResults: number;
time: number;
export interface PipelineResponseInterface {
[k: string]: string | number;
}

export interface SummaryInterface {
queryValues: QueryValuesInterface;
values: ValuesInterface;
response: ResponseInterface;
queryValues: PipelineResponseInterface;
values: PipelineResponseInterface;
response: PipelineResponseInterface;
}

export interface StateChangeOptions<Item> extends StateChangeOptions<Item> {}
Expand Down Expand Up @@ -140,11 +126,13 @@ export class Search extends React.PureComponent<SearchProps<any>, {}> {
summary = {
queryValues: (mapToObject(
response.getQueryValues()
) as unknown) as QueryValuesInterface,
values: mapToObject(response.getValues()) as ValuesInterface,
) as unknown) as PipelineResponseInterface,
values: mapToObject(
response.getValues()
) as PipelineResponseInterface,
response: (mapToObject(response.getResponse() as
| Map<string, any>
| undefined) as unknown) as ResponseInterface
| undefined) as unknown) as PipelineResponseInterface
};
}

Expand Down

0 comments on commit a844c55

Please sign in to comment.