import React, { useState } from 'react' import { CButton, CCard, CCardBody, CCol, CContainer, CForm, CFormInput, CInputGroup, CInputGroupText, CRow, } from '@coreui/react' import CIcon from '@coreui/icons-react' import { cilLockLocked, cilUser } from '@coreui/icons' import axios from 'axios' import { isAutheticated } from 'src/auth' import Swal from 'sweetalert2' import { useHistory } from 'react-router-dom' const Register = () => { const { token } = isAutheticated() const [password, setPassword] = useState({ oldPassword: "", newPassword: "", cpassword: '' }); const history = useHistory(); const handleChange = (e) => (event) => { setPassword({ ...password, [e]: event.target.value }); }; const handleSubmit = async () => { if (password.cpassword !== password.newPassword) { let res = await axios.put('/owner/changePassword', password, { headers: { Authorization: `Bearer ${token}` } }) if (res.statusText === 'OK') { Swal.fire({ title: 'Done', text: 'Password Changed', icon: 'success', confirmButtonText: 'ok', confirmButtonColor: '#303c54', iconColor: '#303c54' }).then(() => { history.push('/profile') }); } } else { alert('new password and confirm password are not matched') } } return (

Change Password

{/*

Create your account

*/} {/* */}
handleSubmit()}>Submit
) } export default Register