### 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.
35 lines
591 B
TypeScript
35 lines
591 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { tenantsSlug } from '../shared.js'
|
|
|
|
export const Tenants: CollectionConfig = {
|
|
slug: tenantsSlug,
|
|
labels: {
|
|
singular: 'Tenant',
|
|
plural: 'Tenants',
|
|
},
|
|
admin: {
|
|
useAsTitle: 'name',
|
|
group: 'Administrative',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'domain',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
{
|
|
type: 'join',
|
|
name: 'users',
|
|
collection: 'users',
|
|
on: 'tenants.tenant',
|
|
},
|
|
],
|
|
}
|