Files
payloadcms/test/plugin-multi-tenant/collections/Menu.ts
Jarrod Flesch 22633a6de6 fix(plugin-multi-tenant): remove tenant cookie on logout (#10761)
### What?
- Removes the tenant cookie when the user logs out
- Prevents double redirect to globals when no tenant is selected

### Why?
There were a couple scenarios where the cookie and the tenant did not
match, ie if you logged into 1 tenant, and then out and then into
another tenant.
2025-01-24 10:10:49 -05:00

45 lines
876 B
TypeScript

import type { CollectionConfig } from 'payload'
import { menuItemsSlug, menuSlug } from '../shared.js'
export const Menu: CollectionConfig = {
slug: menuSlug,
admin: {
useAsTitle: 'title',
group: 'Tenant Globals',
},
fields: [
{
name: 'title',
label: 'Title',
type: 'text',
required: true,
},
{
name: 'description',
type: 'textarea',
},
{
name: 'menuItems',
label: 'Menu Items',
type: 'array',
fields: [
{
name: 'menuItem',
label: 'Menu Item',
type: 'relationship',
relationTo: menuItemsSlug,
required: true,
admin: {
description: 'Automatically filtered by selected tenant',
},
},
{
name: 'active',
type: 'checkbox',
},
],
},
],
}