Files
Homarr/packages/api/src/server.ts
Meier Lukas c4ff968cbc feat: add app widget (#206)
* refactor: move server api to api package

* feat: add app widget

* refactor: add element size for widget components on board

* feat: add resize listener for widget width

* feat: add widget app input

* refactor: add better responsibe layout, add missing translations

* fix: ci issues

* fix: deepsource issues

* chore: address pull request feedback
2024-03-12 21:23:25 +01:00

22 lines
592 B
TypeScript

import { cache } from "react";
import { headers } from "next/headers";
import { createCaller, createTRPCContext } from "@homarr/api";
import { auth } from "@homarr/auth";
/**
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a tRPC call from a React Server Component.
*/
const createContext = cache(async () => {
const heads = new Headers(headers());
heads.set("x-trpc-source", "rsc");
return createTRPCContext({
session: await auth(),
headers: heads,
});
});
export const api = createCaller(createContext);