feat: add provider mapping admin workflow
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-09 13:28:15 -04:00
parent 4c041e069d
commit 0ffccf6617
4 changed files with 92 additions and 2 deletions
@@ -0,0 +1,24 @@
const apiBaseUrl = import.meta.env?.VITE_API_BASE_URL ?? '/api/v1';
async function request(path, options = {}) {
const response = await fetch(`${apiBaseUrl}${path}`, {
credentials: 'include',
...options,
headers: { ...(options.body ? { 'content-type': 'application/json' } : {}), ...options.headers },
});
const payload = await response.json().catch(() => null);
if (!response.ok) throw new Error(payload?.error?.message ?? 'Provider mapping request failed.');
return payload?.data;
}
export function listAdminProviderMappings(productId) {
return request(`/admin/products/${encodeURIComponent(productId)}/provider-mappings`);
}
export function createAdminProviderMapping(productId, input, csrfToken) {
return request(`/admin/products/${encodeURIComponent(productId)}/provider-mappings`, {
method: 'POST',
headers: { 'x-csrf-token': csrfToken },
body: JSON.stringify(input),
});
}