@npio/internals
Version:
A free visual website editor, powered with your own SolidJS components.
22 lines (17 loc) • 616 B
text/typescript
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;
};