mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 08:58:21 +00:00
21 lines
625 B
TypeScript
21 lines
625 B
TypeScript
import { invoices, type Invoice } from "@/pages/billing/invoices.mock";
|
|
import { customers, type Customer } from "@/pages/customers/customers.mock";
|
|
|
|
/**
|
|
* Mock "logged-in customer". When auth integrates, replace this with the value
|
|
* pulled from `@edr/iamui-common` / the JWT context.
|
|
*/
|
|
const CURRENT_CUSTOMER_ID = 1;
|
|
|
|
export function getCurrentCustomer(): Customer {
|
|
return (
|
|
customers.find((c) => c.id === CURRENT_CUSTOMER_ID) ??
|
|
(customers[0] as Customer)
|
|
);
|
|
}
|
|
|
|
export function getMyInvoices(): Invoice[] {
|
|
const me = getCurrentCustomer();
|
|
return invoices.filter((inv) => inv.customerId === me.id);
|
|
}
|