amenpunk %!s(int64=2) %!d(string=hai) anos
pai
achega
501fe9fade
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      src/Components/Password/Operation.jsx

+ 5 - 2
src/Components/Password/Operation.jsx

@@ -11,7 +11,7 @@ import {
11 11
 import toast, { Toaster } from 'react-hot-toast';
12 12
 import * as Yup from 'yup';
13 13
 
14
-import { useQuery } from 'react-query'
14
+import { useQuery, useQueryClient   } from 'react-query'
15 15
 import { Service } from '../../Utils/HTTP.js'
16 16
 import useAuth from '../../Auth/useAuth.js';
17 17
 
@@ -108,6 +108,8 @@ function ModalForm(props) {
108 108
         //plaza_id: Yup.array().required("Escoge una plaza valida")
109 109
     })
110 110
 
111
+    const queryClient = useQueryClient();
112
+
111 113
     const formik = useFormik({
112 114
         initialValues: {
113 115
             state: 1,
@@ -129,10 +131,11 @@ function ModalForm(props) {
129 131
 
130 132
             rest.put(fields, props.token)
131 133
                 .then(result => {
134
+                    queryClient.invalidateQueries('passwords')
132 135
                     console.log(result)
133 136
                     setTimeout(()=>{
134 137
                         props.handleOpen(false)
135
-                    },700)
138
+                    },1000)
136 139
                     toast.success("Contraseña Actualizada")
137 140
                 })
138 141
                 .catch(bad => {