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