mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-01 12:19:21 +01:00
* 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
22 lines
592 B
TypeScript
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);
|