feat(product-edit):商品编辑页初版

This commit is contained in:
R524809
2026-09-09 15:11:58 +08:00
parent 319887726e
commit 130a005231
19 changed files with 1541 additions and 21 deletions
+30
View File
@@ -0,0 +1,30 @@
import type {
ProductEditorContext,
ProductEditorSnapshot,
SaveProductEditorDraftRequest,
SaveProductEditorDraftResponse,
} from '@atlas/contracts';
import { api } from './api';
export const productEditorApi = {
enter: (collectionItemId: string, platformId: string) =>
api.post<ProductEditorContext>(`/collection-items/${collectionItemId}/editor-contexts`, undefined, {
headers: { 'X-Atlas-Platform-Id': platformId, 'Idempotency-Key': crypto.randomUUID() },
}),
read: (productId: string, platformId: string) =>
api.get<ProductEditorSnapshot>(`/products/${productId}/editor`, {
headers: { 'X-Atlas-Platform-Id': platformId },
}),
save: (
productId: string,
platformId: string,
revisions: { product: number; profile: number },
payload: SaveProductEditorDraftRequest,
) => api.put<SaveProductEditorDraftResponse>(`/products/${productId}/editor-draft`, payload, {
headers: {
'X-Atlas-Platform-Id': platformId,
'Idempotency-Key': crypto.randomUUID(),
'If-Match': `"${revisions.product}:${revisions.profile}"`,
},
}),
};