UNPKG

@youngshand/payload-auth-plugin

Version:

A temporary fork for testing of Authentication plugin for Payload CMS, use @payload-auth-plugin

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 }