a
This commit is contained in:
@@ -14,12 +14,19 @@ export const wheelApi = {
|
||||
|
||||
complete: async (
|
||||
assignmentId: number,
|
||||
data: { proof_url?: string; comment?: string; proof_file?: File }
|
||||
data: { proof_url?: string; comment?: string; proof_file?: File; proof_files?: File[] }
|
||||
): Promise<CompleteResult> => {
|
||||
const formData = new FormData()
|
||||
if (data.proof_url) formData.append('proof_url', data.proof_url)
|
||||
if (data.comment) formData.append('comment', data.comment)
|
||||
|
||||
// Support both single file (legacy) and multiple files
|
||||
if (data.proof_file) formData.append('proof_file', data.proof_file)
|
||||
if (data.proof_files && data.proof_files.length > 0) {
|
||||
data.proof_files.forEach(file => {
|
||||
formData.append('proof_files', file)
|
||||
})
|
||||
}
|
||||
|
||||
const response = await client.post<CompleteResult>(`/assignments/${assignmentId}/complete`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
|
||||
Reference in New Issue
Block a user