feat(api-endpoints.ts): add abortRequest endpoint

feat(data-service.ts): add abortRequestWithMessage function
feat(react-query-service.ts): add useAbortRequestWithMessage hook
This commit is contained in:
Daniel Avila 2023-04-09 09:21:04 -04:00
parent f946f90ef6
commit 828e438d53
3 changed files with 12 additions and 0 deletions

View file

@ -6,6 +6,10 @@ export function getConversations(pageNumber: string): Promise<t.TGetConversation
return request.get(endpoints.conversations(pageNumber));
}
export function abortRequestWithMessage(endpoint: string, abortKey: string, message: string): Promise<void> {
return request.post(endpoints.abortRequest(endpoint), { arg: {abortKey, message} });
}
export function deleteConversation(payload: t.TDeleteConversationRequest) {
//todo: this should be a DELETE request
return request.post(endpoints.deleteConversation(), {arg: payload});