This commit is contained in:
seb
2026-09-29 13:45:13 +02:00
parent 4cb050c285
commit 43e1ab98b7
7 changed files with 193 additions and 91 deletions

View File

@@ -265,13 +265,13 @@ export const article = {
/**
* POST /api/article/:sku/image
* Body: raw AVIF bytes (Content-Type: image/avif, max 1000×1000, prepared client-side via WASM)
* Body: raw image bytes (Content-Type: image/webp, max 1000×1000)
* → 201 { image: { picId, sort, full, thumb, fullHash, thumbHash } }
*/
uploadImage(sku, file) {
return httpBinary(`/api/article/${encodeURIComponent(sku)}/image`, {
method: 'POST',
contentType: 'image/avif',
contentType: file?.type || 'image/webp',
body: file,
});
},
@@ -598,13 +598,13 @@ export const category = {
/**
* POST /api/category/:id/image
* Body: raw AVIF bytes (Content-Type: image/avif)
* Body: raw image bytes (Content-Type: image/webp)
* → 201 { category: { id, fullHash, thumbW, thumbH, thumbHash } }
*/
uploadImage(categoryId, file) {
return httpBinary(`/api/category/${categoryId}/image`, {
method: 'POST',
contentType: 'image/avif',
contentType: file?.type || 'image/webp',
body: file,
});
},
@@ -659,13 +659,13 @@ export const brand = {
/**
* POST /api/brand/:id/image
* Accepts full-size AVIF body (Content-Type: image/avif).
* Accepts full-size image body (Content-Type: image/webp).
* → 201 { brand: { id, fullHash, thumbW, thumbH, thumbHash, pics } }
*/
addImage(brandId, file) {
return httpBinary(`/api/brand/${brandId}/image`, {
method: 'POST',
contentType: 'image/avif',
contentType: file?.type || 'image/webp',
body: file,
});
},