Add limits for content + fix video playback
This commit is contained in:
@@ -32,11 +32,16 @@ export const assignmentsApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
// Get proof image as blob URL
|
||||
getProofImageUrl: async (assignmentId: number): Promise<string> => {
|
||||
const response = await client.get(`/assignments/${assignmentId}/proof-image`, {
|
||||
// Get proof media as blob URL (supports both images and videos)
|
||||
getProofMediaUrl: async (assignmentId: number): Promise<{ url: string; type: 'image' | 'video' }> => {
|
||||
const response = await client.get(`/assignments/${assignmentId}/proof-media`, {
|
||||
responseType: 'blob',
|
||||
})
|
||||
return URL.createObjectURL(response.data)
|
||||
const contentType = response.headers['content-type'] || ''
|
||||
const isVideo = contentType.startsWith('video/')
|
||||
return {
|
||||
url: URL.createObjectURL(response.data),
|
||||
type: isVideo ? 'video' : 'image',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user