Added power sum per distributionboard
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
CreateConsumerInput,
|
||||
DistributionBoardDto,
|
||||
ProjectDto,
|
||||
UpdateConsumerInput,
|
||||
} from "../types";
|
||||
|
||||
async function request<T>(url: string, init?: RequestInit): Promise<T> {
|
||||
@@ -54,3 +55,18 @@ export function createConsumer(input: CreateConsumerInput) {
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateConsumer(consumerId: string, input: UpdateConsumerInput) {
|
||||
return request<ConsumerWithCalculatedValues>(`/api/consumers/${consumerId}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteConsumer(consumerId: string) {
|
||||
const response = await fetch(`/api/consumers/${consumerId}`, { method: "DELETE" });
|
||||
if (!response.ok) {
|
||||
const details = await response.text();
|
||||
throw new Error(details || `Request failed with ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user