feat(app-switcher): читать конфиг из auth-portal вместо локального editor
Docker / build (push) Failing after 18s

CURRENT_APP_ID vps; настройка ссылок только на портале.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-07-18 20:59:03 +07:00
co-authored by Cursor
parent 54ffed6e57
commit 03e951af18
9 changed files with 126 additions and 136 deletions
+23 -7
View File
@@ -1,19 +1,35 @@
import { useMemo } from 'react'
import { useQuery } from '@tanstack/react-query'
import type { AppSwitcherConfig } from '@cfdm/shared/contracts/app-switcher'
import { appSwitcherQueryOptions } from '@/queries/app-switcher'
import { getAppUrl as getAppUrlFromConfig } from '@/lib/app-switcher-config'
import { DEFAULT_APP_SWITCHER_CONFIG } from '@/lib/app-switcher-config'
import {
DEFAULT_APP_SWITCHER_CONFIG,
getAppUrl as getAppUrlFromConfig,
} from '@/lib/app-switcher-config'
import { getClaims } from '@/lib/auth'
export function useAppSwitcherConfig(): {
config: AppSwitcherConfig
isLoading: boolean
} {
const { data, isLoading } = useQuery(appSwitcherQueryOptions())
return {
config: data ?? DEFAULT_APP_SWITCHER_CONFIG,
isLoading,
}
const claims = getClaims()
const config = useMemo(() => {
const raw = data ?? DEFAULT_APP_SWITCHER_CONFIG
const apps = raw.apps.filter((a) => (a as { enabled?: boolean }).enabled !== false)
const allowed = claims?.apps
if (!allowed?.length) {
return { ...raw, apps }
}
const set = new Set(allowed)
return {
...raw,
apps: apps.filter((a) => set.has(a.id)),
}
}, [data, claims?.apps])
return { config, isLoading }
}
export function useAppUrl(appId: string): string | undefined {