import { api, cleanResult, configWithToken } from '~/utils/api'; import { INode, IResultWithStatus } from '../types'; import { API } from '~/constants/api'; import { PostCellViewRequest, PostCellViewResult } from '~/types/node'; import { GetSearchResultsRequest, GetSearchResultsResult } from '~/redux/flow/types'; export const postNode = ({ access, node, }: { access: string; node: INode; }): Promise> => api.post(API.NODE.SAVE, { node }, configWithToken(access)).then(cleanResult); export const postCellView = ({ id, flow }: PostCellViewRequest) => api .post(API.NODE.SET_CELL_VIEW(id), { flow }) .then(cleanResult); export const getSearchResults = ({ text, skip = 0 }: GetSearchResultsRequest) => api .get(API.SEARCH.NODES, { params: { text, skip } }) .then(cleanResult);