Files
webapp/app/composables/useActiveTeam.ts

15 lines
567 B
TypeScript

export const useActiveTeam = () => {
const activeTeamId = useState<string | null>('activeTeamId', () => null)
const activeLogtoOrgId = useState<string | null>('activeLogtoOrgId', () => null)
const logtoOrgState = useState<string | null>('logto-org-id', () => null)
const setActiveTeam = (teamId: string | null, logtoOrgId?: string | null) => {
activeTeamId.value = teamId
const nextOrgId = logtoOrgId ?? null
activeLogtoOrgId.value = nextOrgId
logtoOrgState.value = nextOrgId
}
return { activeTeamId, activeLogtoOrgId, setActiveTeam }
}