mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
fix: the content document
This commit is contained in:
@@ -64,6 +64,7 @@ export const portalContentService = {
|
||||
*/
|
||||
async uploadMedia(
|
||||
file: File,
|
||||
onProgress?: (percent: number | null) => void,
|
||||
): Promise<{ key: string; kind: PortalMediaKind; url: string }> {
|
||||
const form = new FormData();
|
||||
form.append("file", file);
|
||||
@@ -72,7 +73,15 @@ export const portalContentService = {
|
||||
key: string;
|
||||
kind: PortalMediaKind;
|
||||
url: string;
|
||||
}>(`${ROOT}/media`, form);
|
||||
}>(`${ROOT}/media`, form, {
|
||||
// A video is big enough that a stalled connection would otherwise sit on
|
||||
// a spinner forever with nothing to tell the author it had failed.
|
||||
timeout: 2 * 60 * 1000,
|
||||
onUploadProgress: (event) =>
|
||||
onProgress?.(
|
||||
event.total ? Math.round((event.loaded / event.total) * 100) : null,
|
||||
),
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user