weee
This commit is contained in:
@@ -47,7 +47,7 @@ export default function AdminDashboardPage() {
|
||||
const fetchAnalytics = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/admin/analytics`, {
|
||||
const response = await fetch(`/api/admin/analytics`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${process.env.NEXT_PUBLIC_JWT_SECRET}`
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function AdminAnalytics() {
|
||||
.find((row) => row.startsWith("Authorization="))
|
||||
?.split("=")[1];
|
||||
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/admin/analytics?range=${dateRange}`, {
|
||||
const response = await fetch(`/api/admin/analytics?range=${dateRange}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
||||
@@ -113,7 +113,7 @@ export default function BroadcastDialog({ open, setOpen }: BroadcastDialogProps)
|
||||
formData.append('message', broadcastMessage);
|
||||
}
|
||||
|
||||
const res = await fetch(`${API_URL}/storefront/broadcast`, {
|
||||
const res = await fetch(`/api/storefront/broadcast`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
|
||||
@@ -106,7 +106,7 @@ export default function ImportProductsModal({ open, setOpen, onImportComplete }:
|
||||
const authToken = document.cookie.split("Authorization=")[1];
|
||||
|
||||
// Send to API
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/products/batch`, {
|
||||
const response = await fetch(`/api/products/batch`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function logoutUser(): Promise<void> {
|
||||
|
||||
if (token) {
|
||||
try {
|
||||
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/logout`, {
|
||||
await fetch(`/api/auth/logout`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
|
||||
Reference in New Issue
Block a user