Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 38x 6x 5x 38x | import { useQuery } from '@tanstack/react-query'
import { apiClient } from '@/lib/axios'
import { schemaToHelp } from '@/shared/utils/schemaHelp'
import type { ConfigSchemaHelpNode } from '@/layers/interfaces'
// Server data (GET /api/v1/config-schemas/project): the help tree is
// derived from the fetched JSON Schema document. Loading or error simply
// leaves help absent — the yaml editor works without it.
export function useProjectConfigSchema(): { help: ConfigSchemaHelpNode[] | undefined } {
const query = useQuery({
queryKey: ['config-schema', 'project'],
queryFn: async () => {
const { data } = await apiClient.get('/config-schemas/project')
return schemaToHelp(data)
},
})
return { help: query.data }
}
|