File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type { AdminDetails } from '@/service/api'
1212import AdminsStatistics from '@/components/admin-statistics.tsx'
1313import { zodResolver } from '@hookform/resolvers/zod'
1414import { queryClient } from '@/utils/query-client.ts'
15+ import useDynamicErrorHandler from '@/hooks/use-dynamic-errors'
1516
1617const initialDefaultValues : Partial < AdminFormValues > = {
1718 username : '' ,
@@ -50,6 +51,7 @@ export default function AdminsPage() {
5051 const modifyDisableAllAdminUsers = useDisableAllActiveUsers ( )
5152 const modifyActivateAllAdminUsers = useActivateAllDisabledUsers ( )
5253 const resetUsageMutation = useResetAdminUsage ( )
54+ const handleError = useDynamicErrorHandler ( )
5355 const handleDelete = async ( admin : AdminDetails ) => {
5456 try {
5557 await removeAdminMutation . mutateAsync ( {
@@ -64,11 +66,11 @@ export default function AdminsPage() {
6466 // Invalidate nodes queries
6567 queryClient . invalidateQueries ( { queryKey : [ '/api/admins' ] } )
6668 } catch ( error ) {
67- toast . error ( t ( 'error' , { defaultValue : 'Error' } ) , {
68- description : t ( 'admins.deleteFailed' , {
69- name : admin . username ,
70- defaultValue : 'Failed to delete node «{{name}}»' ,
71- } ) ,
69+ handleError ( {
70+ error ,
71+ fields : [ ] ,
72+ form ,
73+ contextKey : 'admins' ,
7274 } )
7375 }
7476 }
You can’t perform that action at this time.
0 commit comments