Skip to content

Instantly share code, notes, and snippets.

@kaineer
Created October 24, 2024 09:57
Show Gist options
  • Save kaineer/440393e4c495bd2db839ecf5001a3d71 to your computer and use it in GitHub Desktop.
Save kaineer/440393e4c495bd2db839ecf5001a3d71 to your computer and use it in GitHub Desktop.
PostAnswerVerificationAndRemoveFiles: build.mutation<unknown, AnswerCheckAndRemoveFilesPayload>({
async queryFn(payload, _queryApi, _extraOptions, fetchWithBQ) {
const checkPayload: AnswerCheckPayload = {
playerId: payload.playerId,
nodeId: payload.nodeId,
answerStatus: payload.answerStatus,
mentorsComment: payload.mentorsComment
};
const reviewResult = await fetchWithBQ({
url: backendRoutes.checkVerification,
body: checkPayload,
method: 'POST'
});
if (reviewResult.error) { return { error: reviewResult.error } }
const { fileIds = [] } = payload;
await Promise.all(
fileIds.map((fileId) => fetchWithBQ({
url: makePath(backendRoutes.removeAttachment, { fileId }),
method: 'DELETE',
}))
);
return { data: reviewResult.data };
}
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment