feat(web): view zone without template, snapshot button, no-template status, drop delete

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwxdSt4reTm7Dj1oxRvpP3
This commit is contained in:
2026-07-05 12:19:50 +07:00
parent 5662334799
commit c2832348f8
8 changed files with 217 additions and 45 deletions
+24 -1
View File
@@ -122,14 +122,37 @@ export function useDeleteDomain() {
onSuccess: () => qc.invalidateQueries({ queryKey: ["domains", project?.id] }),
})
}
export function useCheckDomain(id: string) {
export function useCheckDomain(id: string, enabled = true) {
const { project } = useAuth()
return useQuery({
queryKey: ["check", project?.id, id],
queryFn: () => api.checkDomain(project!.id, id),
enabled: !!project && !!id && enabled,
})
}
export function useZoneRecords(id: string) {
const { project } = useAuth()
return useQuery({
queryKey: ["zoneRecords", project?.id, id],
queryFn: () => api.zoneRecords(project!.id, id),
enabled: !!project && !!id,
})
}
export function useCreateTemplateFromZone() {
const { project } = useAuth()
const qc = useQueryClient()
return useMutation({
mutationFn: (id: string) => {
const pid = requireProjectId(project)
return api.templateFromZone(pid, id)
},
onSuccess: (_data, id) => {
qc.invalidateQueries({ queryKey: ["domains", project?.id] })
qc.invalidateQueries({ queryKey: ["zoneRecords", project?.id, id] })
qc.invalidateQueries({ queryKey: ["check", project?.id, id] })
},
})
}
export function useApplyDomain(id: string) {
const { project } = useAuth()
const qc = useQueryClient()