|
|
@@ -8,7 +8,7 @@ import {
|
|
|
|
|
|
import toast, { Toaster } from 'react-hot-toast';
|
|
|
|
|
|
-import { useMutation } from 'react-query';
|
|
|
+import { useMutation, useQueryClient } from 'react-query';
|
|
|
import { Service } from '../../../Utils/HTTP.js'
|
|
|
import useAuth from '../../../Auth/useAuth.js'
|
|
|
|
|
|
@@ -30,12 +30,13 @@ let theme = createTheme({
|
|
|
|
|
|
export function Resume(props) {
|
|
|
|
|
|
- let { handleBack, password: key, handleClose } = props
|
|
|
+ let { handleBack, password: key, handleClose,handleReset } = props
|
|
|
const fmt = React.useRef({ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' })
|
|
|
const [pwdID, setPwdID] = React.useState(null);
|
|
|
const [loading, setLoading] = React.useState(false);
|
|
|
const auth = useAuth();
|
|
|
const token = auth.getToken();
|
|
|
+ const queryClient = useQueryClient();
|
|
|
|
|
|
const savePassword = async (body) => {
|
|
|
let rest = new Service('/contrasenia/create')
|
|
|
@@ -90,12 +91,14 @@ export function Resume(props) {
|
|
|
candiMutation.mutate(candidatoBody, {
|
|
|
onSuccess: (data) => {
|
|
|
|
|
|
+ queryClient.invalidateQueries('passwords')
|
|
|
toast.success("Contraseña agregada exitosamente!!")
|
|
|
setTimeout(() => {
|
|
|
console.log("OK LETS GO >> ", data,pwdID)
|
|
|
setLoading(false);
|
|
|
handleClose();
|
|
|
- }, 2000)
|
|
|
+ handleReset();
|
|
|
+ }, 1000)
|
|
|
|
|
|
},
|
|
|
onError: () => {
|