feat(product-edit):商品编辑页初版
This commit is contained in:
@@ -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}"`,
|
||||
},
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user