chore: heygermany customer project
Some checks failed
Main / Setup and Test (push) Has been cancelled
Main / Build Website (push) Has been cancelled

This commit is contained in:
e2e
2026-07-11 08:26:01 +02:00
commit 9c39da4d3f
398 changed files with 38331 additions and 0 deletions

24
apps/website/pikku/rpc.ts Normal file
View File

@@ -0,0 +1,24 @@
export async function invokeRPC<TOutput = unknown>(
rpcName: string,
data?: Record<string, unknown>
): Promise<TOutput> {
const response = await fetch(`/remote/rpc/${encodeURIComponent(rpcName)}`, {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ data }),
})
if (!response.ok) {
throw new Error((await response.text()) || `RPC ${rpcName} failed`)
}
if (response.status === 204) {
return undefined as TOutput
}
const text = await response.text()
return text ? JSON.parse(text) as TOutput : undefined as TOutput
}