UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

28 lines (27 loc) 1.04 kB
import { getMainLayoutProps, getPropsFromParams } from "./utils/props.mjs"; import { formatSearchFields, getParamsFromUrl } from "./utils/server.mjs"; const getNextAdminProps = async ({ prisma, basePath, apiBasePath, options, url, locale, getMessages })=>{ const urlObj = url.startsWith("http://") || url.startsWith("https://") ? new URL(url) : null; const urlWithoutOrigin = urlObj ? urlObj.href.replace(urlObj.origin, "") : url; const params = getParamsFromUrl(urlWithoutOrigin, basePath); const requestOptions = formatSearchFields(urlWithoutOrigin); const props = await getPropsFromParams({ options, prisma, basePath, apiBasePath, searchParams: requestOptions, params, isAppDir: false, locale, getMessages }); return { props }; }; const pageRouter_getMainLayoutProps = (args)=>getMainLayoutProps({ ...args, isAppDir: false }); export { pageRouter_getMainLayoutProps as getMainLayoutProps, getNextAdminProps };