fix bug and errors

This commit is contained in:
SlimusMinus
2026-10-06 01:00:10 +03:00
parent 73e3634ec4
commit d94a6782a4
50 changed files with 937 additions and 2642 deletions

View File

@@ -63,30 +63,3 @@ export function putWithProgress(url, file, onProgress) {
xhr.send(file);
});
}
export async function uploadAdVideo(advertisingId, file, onProgress) {
const presignRes = await apiFetch(
`${API_URL}/api/v1/admin/ads/${advertisingId}/video/presign-upload`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ contentType: file.type }),
}
);
if (!presignRes.ok) throw new Error(`Presign failed (${presignRes.status})`);
const { uploadUrl, sourceKey } = await presignRes.json();
await putWithProgress(uploadUrl, file, onProgress);
const confirmRes = await apiFetch(
`${API_URL}/api/v1/admin/ads/${advertisingId}/video/confirm-upload`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sourceKey }),
}
);
if (!confirmRes.ok) throw new Error(`Confirm failed (${confirmRes.status})`);
return { sourceKey };
}