@@ -46,8 +46,8 @@ export default function ImportStatusPage() {
|
||||
setError(null);
|
||||
|
||||
const [summaryRes, byMerchantRes] = await Promise.all([
|
||||
fetch(`${API_BASE_URL}/api/admin/import-status/summary`),
|
||||
fetch(`${API_BASE_URL}/api/admin/import-status/by-merchant`),
|
||||
fetch('/api/admin/import-status/summary', { credentials: 'include' }),
|
||||
fetch('/api/admin/import-status/by-merchant', { credentials: 'include' }),
|
||||
]);
|
||||
|
||||
if (!summaryRes.ok || !byMerchantRes.ok) {
|
||||
@@ -108,9 +108,10 @@ export default function ImportStatusPage() {
|
||||
try {
|
||||
setImportingId(merchantId);
|
||||
const res = await fetch(
|
||||
`${API_BASE_URL}/api/admin/merchants/${merchantId}/import`,
|
||||
`/api/admin/merchants/${merchantId}/import`,
|
||||
{
|
||||
method: "POST",
|
||||
credentials: 'include',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+3
-1
@@ -24,7 +24,9 @@ export default function AdminLandingPage() {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const res = await fetch(`${API_BASE_URL}/api/admin/dashboard/overview`);
|
||||
const res = await fetch('/api/admin/dashboard/overview', {
|
||||
credentials: 'include',
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load dashboard (${res.status})`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user