PromucFlow_constructor/app/client/src/actions/apiPaneActions.ts

63 lines
1.5 KiB
TypeScript
Raw Normal View History

2019-11-25 09:15:11 +00:00
import { ReduxAction, ReduxActionTypes } from "constants/ReduxActionConstants";
import { EventLocation } from "utils/AnalyticsUtil";
2019-11-25 09:15:11 +00:00
export const changeApi = (
id: string,
newApi?: boolean,
): ReduxAction<{ id: string; newApi?: boolean }> => {
2019-11-25 09:15:11 +00:00
return {
type: ReduxActionTypes.API_PANE_CHANGE_API,
payload: { id, newApi },
2019-11-25 09:15:11 +00:00
};
};
export const initApiPane = (urlId?: string): ReduxAction<{ id?: string }> => {
return {
type: ReduxActionTypes.INIT_API_PANE,
payload: { id: urlId },
};
};
2020-04-20 08:26:19 +00:00
export const setCurrentCategory = (
category: string,
): ReduxAction<{ category: string }> => {
return {
type: ReduxActionTypes.SET_CURRENT_CATEGORY,
payload: { category },
};
};
export const setLastUsedEditorPage = (
path: string,
): ReduxAction<{ path: string }> => {
return {
type: ReduxActionTypes.SET_LAST_USED_EDITOR_PAGE,
payload: { path },
};
};
export const setLastSelectedPage = (
selectedPageId: string,
): ReduxAction<{ selectedPageId: string }> => {
return {
type: ReduxActionTypes.SET_LAST_SELECTED_PAGE_PAGE,
payload: { selectedPageId },
};
};
2020-04-20 08:26:19 +00:00
export const createNewApiAction = (
pageId: string,
from: EventLocation,
): ReduxAction<{ pageId: string; from: EventLocation }> => ({
2020-04-20 08:26:19 +00:00
type: ReduxActionTypes.CREATE_NEW_API_ACTION,
payload: { pageId, from },
2020-04-20 08:26:19 +00:00
});
export const createNewQueryAction = (
pageId: string,
from: EventLocation,
): ReduxAction<{ pageId: string; from: EventLocation }> => ({
type: ReduxActionTypes.CREATE_NEW_QUERY_ACTION,
payload: { pageId, from },
});