UNPKG

nitropage

Version:

A free and open source, extensible visual page builder based on SolidStart.

22 lines (17 loc) 619 B
import type { NitroProject } from "@prisma/client"; import type { FetchEvent } from "@solidjs/start/server"; import { getRequestEvent } from "solid-js/web"; import { NPConfig } from "../../types"; export const getFetchEvent = () => getRequestEvent()! as any as FetchEvent; export const getEventProject = (): NitroProject => { const event = getFetchEvent(); return event.locals.npProject; }; export const getClientConfig = (): NPConfig => { const event = getFetchEvent(); return event.locals.npConfig; }; export const getEventUrl = (): URL => { const event = getFetchEvent(); return event.locals.url; };