feat(api): add create and update functionality for charge points with registration status

This commit is contained in:
2026-03-10 15:48:03 +08:00
parent 2cb89c74b3
commit 08cd00c802
5 changed files with 359 additions and 123 deletions

View File

@@ -99,8 +99,24 @@ export const api = {
chargePoints: {
list: () => apiFetch<ChargePoint[]>("/api/charge-points"),
get: (id: number) => apiFetch<ChargePoint>(`/api/charge-points/${id}`),
update: (id: string, data: { feePerKwh: number }) =>
apiFetch<{ feePerKwh: number }>(`/api/charge-points/${id}`, {
create: (data: {
chargePointIdentifier: string;
chargePointVendor?: string;
chargePointModel?: string;
registrationStatus?: "Accepted" | "Pending" | "Rejected";
feePerKwh?: number;
}) =>
apiFetch<ChargePoint>("/api/charge-points", {
method: "POST",
body: JSON.stringify(data),
}),
update: (id: string, data: {
feePerKwh?: number;
registrationStatus?: "Accepted" | "Pending" | "Rejected";
chargePointVendor?: string;
chargePointModel?: string;
}) =>
apiFetch<ChargePoint>(`/api/charge-points/${id}`, {
method: "PATCH",
body: JSON.stringify(data),
}),