weewoo
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { fetchData } from "@/lib/data-service";
|
||||
import { fetchData } from "@/lib/api";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Image from "next/image";
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { apiRequest } from "@/lib/storeHelper";
|
||||
import { apiRequest } from "@/lib/api";
|
||||
import type { Category } from "@/models/categories";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { fetchData } from '@/lib/data-service';
|
||||
import { clientFetch } from '@/lib/client-utils';
|
||||
import { fetchData } from '@/lib/api';
|
||||
import { clientFetch } from '@/lib/api';
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "next/navigation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import Dashboard from "@/components/dashboard/dashboard";
|
||||
import Content from "@/components/dashboard/content";
|
||||
import { fetchServer } from '@/lib/server-service';
|
||||
import { fetchServer } from '@/lib/api';
|
||||
import { performance } from 'perf_hooks';
|
||||
import { Info, GitCommit, User, Zap } from 'lucide-react';
|
||||
import packageJson from '../../package.json';
|
||||
import { getGitCommitInfo } from '@/lib/git-utils';
|
||||
import { getGitInfo, getShortGitHash } from '@/lib/utils/git';
|
||||
|
||||
// ✅ Corrected Vendor Type
|
||||
interface Vendor {
|
||||
@@ -29,16 +29,18 @@ interface OrderStats {
|
||||
export default async function DashboardPage() {
|
||||
const startTime = performance.now();
|
||||
|
||||
const [userResponse, orderStats, gitInfo] = await Promise.all([
|
||||
const [userResponse, orderStats] = await Promise.all([
|
||||
fetchServer<User>("/auth/me"),
|
||||
fetchServer<OrderStats>("/orders/stats"),
|
||||
getGitCommitInfo()
|
||||
fetchServer<OrderStats>("/orders/stats")
|
||||
]);
|
||||
|
||||
// Get git info using the new utility
|
||||
const gitInfo = getGitInfo();
|
||||
|
||||
const endTime = performance.now();
|
||||
const generationTime = (endTime - startTime).toFixed(2);
|
||||
const panelVersion = packageJson.version;
|
||||
const commitHash = gitInfo.commitHash;
|
||||
const commitHash = gitInfo.hash;
|
||||
|
||||
const vendor = userResponse.vendor;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
saveProductImage,
|
||||
deleteProductData,
|
||||
} from "@/lib/productData";
|
||||
import { clientFetch } from "@/lib/client-utils";
|
||||
import { clientFetch } from "@/lib/api";
|
||||
import { ProductModal } from "@/components/modals/product-modal";
|
||||
import ProductTable from "@/components/tables/product-table";
|
||||
import { Category } from "@/models/categories";
|
||||
|
||||
@@ -12,9 +12,9 @@ import {
|
||||
addShippingMethod,
|
||||
deleteShippingMethod,
|
||||
updateShippingMethod,
|
||||
} from "@/lib/shippingHelper";
|
||||
|
||||
import { ShippingMethod, ShippingData } from "@/lib/types";
|
||||
ShippingMethod,
|
||||
ShippingData
|
||||
} from "@/lib/services/shipping-service";
|
||||
|
||||
import { ShippingTable } from "@/components/tables/shipping-table";
|
||||
|
||||
@@ -89,8 +89,8 @@ export default function ShippingPage() {
|
||||
}
|
||||
|
||||
await addShippingMethod(
|
||||
authToken,
|
||||
newShipping
|
||||
newShipping,
|
||||
authToken
|
||||
);
|
||||
|
||||
// Close modal and reset form before refreshing to avoid UI delays
|
||||
@@ -125,9 +125,9 @@ export default function ShippingPage() {
|
||||
}
|
||||
|
||||
await updateShippingMethod(
|
||||
authToken,
|
||||
newShipping._id,
|
||||
newShipping
|
||||
newShipping,
|
||||
authToken
|
||||
);
|
||||
|
||||
// Close modal and reset form before refreshing to avoid UI delays
|
||||
@@ -150,7 +150,7 @@ export default function ShippingPage() {
|
||||
const handleDeleteShipping = async (_id: string) => {
|
||||
try {
|
||||
const authToken = document.cookie.split("Authorization=")[1];
|
||||
const response = await deleteShippingMethod(authToken, _id);
|
||||
const response = await deleteShippingMethod(_id, authToken);
|
||||
if (response.success) {
|
||||
refreshShippingMethods(); // Refresh the list after deleting
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Product } from "@/models/products";
|
||||
import { Package, RefreshCw, ChevronDown, CheckSquare, XSquare } from "lucide-react";
|
||||
import { fetchProductData, updateProductStock, saveProductData } from "@/lib/productData";
|
||||
import { fetchProductData, updateProductStock, saveProductData } from "@/lib/api";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export default function StockManagementPage() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState, useCallback } from "react";
|
||||
import { getCustomers, CustomerStats } from "@/services/customerService";
|
||||
import { getCustomers, type CustomerStats } from "@/lib/api";
|
||||
import { formatCurrency } from "@/utils/format";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Save, Send, Key, MessageSquare, Shield, Globe, Wallet } from "lucide-react";
|
||||
import { apiRequest } from "@/lib/storeHelper";
|
||||
import { apiRequest } from "@/lib/api";
|
||||
import { toast, Toaster } from "sonner";
|
||||
import BroadcastDialog from "@/components/modals/broadcast-dialog";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Link from "next/link";
|
||||
import { ArrowRight, Shield, LineChart, Zap } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { fetchPlatformStats } from "@/lib/stats-service";
|
||||
import { getPlatformStatsServer } from "@/lib/api";
|
||||
import { HomeNavbar } from "@/components/home-navbar";
|
||||
import { Suspense } from "react";
|
||||
import { AnimatedStatsSection } from "@/components/animated-stats-section";
|
||||
@@ -31,7 +31,7 @@ function formatCurrencyValue(amount: number): string {
|
||||
// This is a server component
|
||||
export default async function Home() {
|
||||
try {
|
||||
const stats = await fetchPlatformStats();
|
||||
const stats = await getPlatformStatsServer();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col min-h-screen bg-black text-white">
|
||||
|
||||
Reference in New Issue
Block a user