amenpunk 2 years ago
parent
commit
c9bc424388
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/Components/Password/Operation.jsx

+ 9 - 9
src/Components/Password/Operation.jsx

8
 import toast, { Toaster } from 'react-hot-toast';
8
 import toast, { Toaster } from 'react-hot-toast';
9
 import * as Yup from 'yup';
9
 import * as Yup from 'yup';
10
 
10
 
11
-import { useQuery, useQueryClient } from 'react-query'
11
+import { useQueryClient } from 'react-query'
12
 import { Service } from '../../Utils/HTTP.js'
12
 import { Service } from '../../Utils/HTTP.js'
13
 import { useSelector } from 'react-redux'
13
 import { useSelector } from 'react-redux'
14
 
14
 
19
 
19
 
20
 export function ModalEdit(props) {
20
 export function ModalEdit(props) {
21
 
21
 
22
-  let { password, open, handleOpen } = props
22
+  const auth = useSelector((state) => state.token)
23
   let [data,setData] = React.useState(null)
23
   let [data,setData] = React.useState(null)
24
+  let { password, open, handleOpen } = props
24
   let { pwd, plz } = password
25
   let { pwd, plz } = password
25
 
26
 
26
-  const auth = useSelector((state) => state.token)
27
+  React.useEffect(()=> {
27
 
28
 
28
-  const getPassword = async () => {
29
-    let rest = new Service(`/contrasenia/${btoa(pwd)}/${plz}`)
30
-    return await rest.getQuery(auth.token)
31
-  }
29
+    const getPassword = async () => {
30
+      let rest = new Service(`/contrasenia/${btoa(pwd)}/${plz}`)
31
+      return await rest.getQuery(auth.token)
32
+    }
32
 
33
 
33
-  React.useEffect(()=> {
34
     getPassword()
34
     getPassword()
35
       .then( resp => setData(resp.data))
35
       .then( resp => setData(resp.data))
36
       .catch( error => console.log(error))
36
       .catch( error => console.log(error))
37
-  },[])
37
+  },[auth.token,pwd,plz])
38
 
38
 
39
   return (
39
   return (
40
     <Dialog
40
     <Dialog