|
@@ -8,7 +8,7 @@ import {
|
8
|
8
|
|
9
|
9
|
import toast, { Toaster } from 'react-hot-toast';
|
10
|
10
|
|
11
|
|
-import { useMutation } from 'react-query';
|
|
11
|
+import { useMutation, useQueryClient } from 'react-query';
|
12
|
12
|
import { Service } from '../../../Utils/HTTP.js'
|
13
|
13
|
import useAuth from '../../../Auth/useAuth.js'
|
14
|
14
|
|
|
@@ -30,12 +30,13 @@ let theme = createTheme({
|
30
|
30
|
|
31
|
31
|
export function Resume(props) {
|
32
|
32
|
|
33
|
|
- let { handleBack, password: key, handleClose } = props
|
|
33
|
+ let { handleBack, password: key, handleClose,handleReset } = props
|
34
|
34
|
const fmt = React.useRef({ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' })
|
35
|
35
|
const [pwdID, setPwdID] = React.useState(null);
|
36
|
36
|
const [loading, setLoading] = React.useState(false);
|
37
|
37
|
const auth = useAuth();
|
38
|
38
|
const token = auth.getToken();
|
|
39
|
+ const queryClient = useQueryClient();
|
39
|
40
|
|
40
|
41
|
const savePassword = async (body) => {
|
41
|
42
|
let rest = new Service('/contrasenia/create')
|
|
@@ -90,12 +91,14 @@ export function Resume(props) {
|
90
|
91
|
candiMutation.mutate(candidatoBody, {
|
91
|
92
|
onSuccess: (data) => {
|
92
|
93
|
|
|
94
|
+ queryClient.invalidateQueries('passwords')
|
93
|
95
|
toast.success("Contraseña agregada exitosamente!!")
|
94
|
96
|
setTimeout(() => {
|
95
|
97
|
console.log("OK LETS GO >> ", data,pwdID)
|
96
|
98
|
setLoading(false);
|
97
|
99
|
handleClose();
|
98
|
|
- }, 2000)
|
|
100
|
+ handleReset();
|
|
101
|
+ }, 1000)
|
99
|
102
|
|
100
|
103
|
},
|
101
|
104
|
onError: () => {
|