u
This commit is contained in:
@@ -180,7 +180,7 @@ export const article = {
|
||||
/**
|
||||
* POST /api/article/:sku/image
|
||||
* Body: raw AVIF bytes (Content-Type: image/avif, max 1000×1000, prepared client-side via WASM)
|
||||
* → 201 { image: { picId, sort, full, thumb, hash, thumbHash } }
|
||||
* → 201 { image: { picId, sort, full, thumb, fullHash, thumbHash } }
|
||||
*/
|
||||
uploadImage(sku, file) {
|
||||
return httpBinary(`/api/article/${encodeURIComponent(sku)}/image`, {
|
||||
@@ -191,6 +191,20 @@ export const article = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Content-addressed thumb AVIF by fullHash (SHA-256 hex of full image bytes).
|
||||
* Auth: session cookie. Browser-cacheable (private, immutable, ETag).
|
||||
*/
|
||||
export const thumb = {
|
||||
/**
|
||||
* GET /api/thumb/:fullHash → image/avif (thumb bytes)
|
||||
* Use as <img src={thumb.url(fullHash)} /> (same-origin; cookies sent).
|
||||
*/
|
||||
url(fullHash) {
|
||||
return `/api/thumb/${encodeURIComponent(fullHash)}`;
|
||||
},
|
||||
};
|
||||
|
||||
export const category = {
|
||||
/** GET /api/category/tree → { languageId, tree, articles } (company from session) */
|
||||
getTree() {
|
||||
@@ -310,4 +324,4 @@ export const auth = {
|
||||
},
|
||||
};
|
||||
|
||||
export default { auth, article, category, company };
|
||||
export default { auth, article, category, company, thumb };
|
||||
|
||||
Reference in New Issue
Block a user