UNPKG

@payloadcms/plugin-multi-tenant

Version:
26 lines (25 loc) 966 B
import { headers as getHeaders } from 'next/headers.js'; import { redirect } from 'next/navigation.js'; import { getGlobalViewRedirect } from '../../utilities/getGlobalViewRedirect.js'; export const GlobalViewRedirect = async (args)=>{ const collectionSlug = args?.collectionSlug; if (collectionSlug && args.globalSlugs?.includes(collectionSlug)) { const headers = await getHeaders(); const redirectRoute = await getGlobalViewRedirect({ slug: collectionSlug, basePath: args.basePath, docID: args.docID, headers, payload: args.payload, tenantFieldName: args.tenantFieldName, tenantsCollectionSlug: args.tenantsCollectionSlug, useAsTitle: args.useAsTitle, user: args.user, view: args.viewType }); if (redirectRoute) { redirect(redirectRoute); } } }; //# sourceMappingURL=index.js.map