fixing admin pages
CI / test (push) Successful in 6s

This commit is contained in:
2026-01-25 14:22:58 -05:00
parent e49dc96522
commit 3aee0e6755
11 changed files with 311 additions and 10 deletions
+10 -6
View File
@@ -198,8 +198,9 @@ export default function MappingAdminPage() {
// EXPECTED backend endpoint (new):
// GET { merchants: [{id,name}], canonicalCategories: [{id,name,slug}] }
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/options`, {
const res = await fetch('/api/admin/mapping/options', {
headers: { Accept: "application/json" },
credentials: 'include',
cache: "no-store",
});
@@ -243,8 +244,9 @@ export default function MappingAdminPage() {
if (tab === "roles") {
// Existing endpoint you already have:
// GET /api/admin/mapping/pending-buckets
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/pending-buckets`, {
const res = await fetch('/api/admin/mapping/pending-buckets', {
headers: { Accept: "application/json" },
credentials: 'include',
cache: "no-store",
});
@@ -277,8 +279,8 @@ export default function MappingAdminPage() {
if (q?.trim()) params.set("q", q.trim());
const res = await fetch(
`${API_BASE_URL}/api/admin/mapping/raw-categories?${params.toString()}`,
{ headers: { Accept: "application/json" }, cache: "no-store" }
`/api/admin/mapping/raw-categories?${params.toString()}`,
{ headers: { Accept: "application/json" }, credentials: 'include', cache: "no-store" }
);
if (!res.ok) {
@@ -336,9 +338,10 @@ export default function MappingAdminPage() {
// Existing endpoint you already have:
// POST /api/admin/mapping/apply
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/apply`, {
const res = await fetch('/api/admin/mapping/apply', {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: 'include',
body: JSON.stringify({
merchantId: row.merchantId,
rawCategoryKey: row.rawCategoryKey,
@@ -390,9 +393,10 @@ export default function MappingAdminPage() {
// EXPECTED new endpoint:
// POST /api/admin/mapping/upsert
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/upsert`, {
const res = await fetch('/api/admin/mapping/upsert', {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: 'include',
body: JSON.stringify({
merchantId: row.merchantId,
platform: row.platform ?? platform ?? null,