fix admin pages

This commit is contained in:
root
2026-05-17 17:37:13 -04:00
parent 0b73504455
commit 5ea1780134
12 changed files with 42 additions and 53 deletions
@@ -2,8 +2,7 @@
import { useEffect, useState } from 'react'
import { useAdminI18n } from '@/components/I18nProvider'
const API_BASE = '/api/v1'
import { ADMIN_API_BASE } from '@/lib/api'
interface Company {
id: string
@@ -216,7 +215,7 @@ export default function AdminBillingPage() {
try {
const params = new URLSearchParams({ pageSize: '50' })
if (status) params.set('status', status)
const res = await fetch(`${API_BASE}/admin/billing?${params}`, {
const res = await fetch(`${ADMIN_API_BASE}/admin/billing?${params}`, {
headers: token ? { Authorization: `Bearer ${token}` } : {},
cache: 'no-store',
})
@@ -236,7 +235,7 @@ export default function AdminBillingPage() {
async function downloadInvoicePdf(invoiceId: string, createdAt: string) {
const token = localStorage.getItem('admin_token')
try {
const res = await fetch(`${API_BASE}/admin/billing/invoices/${invoiceId}/pdf`, {
const res = await fetch(`${ADMIN_API_BASE}/admin/billing/invoices/${invoiceId}/pdf`, {
headers: token ? { Authorization: `Bearer ${token}` } : {},
})
if (!res.ok) throw new Error('Failed to generate PDF')
@@ -259,7 +258,7 @@ export default function AdminBillingPage() {
setInvoicesLoading(true)
const token = localStorage.getItem('admin_token')
try {
const res = await fetch(`${API_BASE}/admin/billing/${companyId}/invoices?pageSize=50`, {
const res = await fetch(`${ADMIN_API_BASE}/admin/billing/${companyId}/invoices?pageSize=50`, {
headers: token ? { Authorization: `Bearer ${token}` } : {},
})
const json = await res.json()