Created
October 24, 2024 09:57
-
-
Save kaineer/440393e4c495bd2db839ecf5001a3d71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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