2019-11-21 12:13:41 +00:00
|
|
|
import { IntlShape } from "react-intl";
|
|
|
|
|
2019-11-21 17:47:06 +00:00
|
|
|
import {
|
|
|
|
CheckIfOrderExists,
|
|
|
|
CheckIfOrderExistsVariables
|
|
|
|
} from "../queries/types/CheckIfOrderExists";
|
2019-11-21 12:13:41 +00:00
|
|
|
import { QuickSearchAction, QuickSearchMode } from "../types";
|
|
|
|
import getDefaultModeActions from "./default";
|
|
|
|
import getOrdersModeActions from "./orders";
|
2019-11-21 17:47:06 +00:00
|
|
|
import { ActionQueries } from "./types";
|
2019-11-21 12:13:41 +00:00
|
|
|
|
|
|
|
function getModeActions(
|
|
|
|
mode: QuickSearchMode,
|
|
|
|
query: string,
|
2019-11-21 17:47:06 +00:00
|
|
|
intl: IntlShape,
|
|
|
|
queries: ActionQueries
|
2019-11-21 12:13:41 +00:00
|
|
|
): QuickSearchAction[] {
|
|
|
|
switch (mode) {
|
|
|
|
case "orders":
|
2019-11-21 17:47:06 +00:00
|
|
|
return getOrdersModeActions(query, intl, queries.order);
|
2019-11-21 12:13:41 +00:00
|
|
|
default:
|
|
|
|
return getDefaultModeActions(query, intl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default getModeActions;
|