Skip to content

Commit

Permalink
refactor: fix action type
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Nov 2, 2023
1 parent 266aad0 commit acacdb2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/api/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ export const getAggregateActions = async (
{ API_HOST, axios }: PartialQueryConfigForApi,
) =>
axios
.get<{ aggregateResult: number; createdDay: string }[]>(
`${API_HOST}/${buildGetAggregateActions(args)}`,
)
.get<
{
aggregateResult: number;
createdDay?: string;
createdTimeOfDay?: string;
createdDayOfWeek?: string;
actionType?: string;
}[]
>(`${API_HOST}/${buildGetAggregateActions(args)}`)
.then(({ data }) => data);

export const exportActions = async (
args: { itemId: UUID },
{ API_HOST, axios }: PartialQueryConfigForApi,
): Promise<void> =>
axios.post(`${API_HOST}/${buildExportActions(args.itemId)}`);
) => axios.post<void>(`${API_HOST}/${buildExportActions(args.itemId)}`);

export const postItemAction = async (
itemId: UUID,
payload: { type: string; extra?: { [key: string]: unknown } },
{ API_HOST, axios }: PartialQueryConfigForApi,
): Promise<Action> =>
axios.post(`${API_HOST}/${buildPostItemAction(itemId)}`, payload);
) => axios.post<Action>(`${API_HOST}/${buildPostItemAction(itemId)}`, payload);

0 comments on commit acacdb2

Please sign in to comment.