|
- import { serverFetchJson } from "@/app/utils/fetchUtil";
- import { BASE_API_URL } from "@/config/api";
- import { cache } from "react";
- import "server-only";
-
- export interface InvoiceResult {
- id: number;
- projectCode: string;
- projectName: string;
- stage: String;
- comingPaymentMileStone: string;
- paymentMilestoneDate: string;
- resourceUsage: number;
- unbilledHours: number;
- reminder: string;
- }
-
- export interface InvoiceInformatio{
- id: number;
- address: string;
- attention: string;
- invoiceDate: string;
- dueDate: string;
- projectRefNo: string;
- }
-
- export const preloadInvoices = () => {
- fetchInvoices();
- };
-
- export const fetchInvoices = cache(async () => {
- return serverFetchJson<InvoiceResult[]>(`${BASE_API_URL}/invoices`, {
- next: { tags: ["invoices"] },
- });
- });
|