feat(web): api client and hooks for custom record marks
This commit is contained in:
@@ -153,6 +153,36 @@ export function useApplyDomain(id: string) {
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ["check", project?.id, id] }),
|
||||
})
|
||||
}
|
||||
export function useAddCustom(id: string) {
|
||||
const { project } = useAuth()
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (key: string) => {
|
||||
const pid = requireProjectId(project)
|
||||
return api.addCustom(pid, id, key)
|
||||
},
|
||||
// Дифф пересчитывается на бэкенде — инвалидируем чек, а заодно статус
|
||||
// домена в списке (custom-запись перестаёт быть дрифтом).
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: ["check", project?.id, id] })
|
||||
qc.invalidateQueries({ queryKey: ["domains", project?.id] })
|
||||
},
|
||||
})
|
||||
}
|
||||
export function useRemoveCustom(id: string) {
|
||||
const { project } = useAuth()
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (key: string) => {
|
||||
const pid = requireProjectId(project)
|
||||
return api.removeCustom(pid, id, key)
|
||||
},
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: ["check", project?.id, id] })
|
||||
qc.invalidateQueries({ queryKey: ["domains", project?.id] })
|
||||
},
|
||||
})
|
||||
}
|
||||
export function useDomainHistory(id: string) {
|
||||
const { project } = useAuth()
|
||||
return useQuery({
|
||||
|
||||
Reference in New Issue
Block a user