Skip to content

Commit

Permalink
chore(templates): fix multi-tenant selector value
Browse files Browse the repository at this point in the history
  • Loading branch information
janbiasi committed Jan 9, 2025
1 parent 35d72f4 commit 9cb7a9d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import * as qs from 'qs-esm'

import type { Tenant, User } from '@/payload-types'
import { getTenantAdminTenantAccessIDs } from '@/utilities/getTenantAccessIDs'
import { extractID } from '@/utilities/extractID'
import { TENANT_COOKIE_NAME } from '@/collections/Tenants/cookie'
import { userRole } from '@/collections/Users/roles'
import { extractID } from '@/utilities/extractID'

import './index.scss'

Expand Down Expand Up @@ -65,6 +65,8 @@ export const TenantSelector = ({ initialCookie }: { initialCookie?: string }) =>
credentials: 'include',
}).then((res) => res.json())

console.log(initialCookie, res)

const optionsToSet = res.docs.map((doc: Tenant) => ({
label: doc.name,
value: doc.id,
Expand All @@ -85,12 +87,14 @@ export const TenantSelector = ({ initialCookie }: { initialCookie?: string }) =>
return (
<div className="tenant-selector">
<SelectInput
isClearable={false}
isSortable={false}
label="Select a tenant"
name="setTenant"
onChange={handleChange}
options={options}
path="setTenant"
value={options.find((opt) => opt.value === initialCookie)?.value}
value={options.find((opt) => String(opt.value) === String(initialCookie))?.value}
/>
</div>
)
Expand Down

0 comments on commit 9cb7a9d

Please sign in to comment.