UNPKG

@daliboru/payload-auth-plugin-fork

Version:

Forked payload-auth-plugin with custom access token feature.

21 lines (19 loc) 460 B
import { CollectionConfig } from "payload" import { InvalidCollectionSlug, MissingCollections, } from "../errors/consoleErrors.js" export function preflightCollectionCheck( slugs: string[], collections: CollectionConfig[] | undefined, ) { if (!collections?.length) { throw new MissingCollections() } slugs.forEach((slug) => { if (!collections.some((c) => c.slug === slug)) { throw new InvalidCollectionSlug() } }) return }