import React, { useState } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faAngleLeft, faEnvelope, faLockOpen, faUnlockAlt } from '@fortawesome/free-solid-svg-icons' import { Col, Row, Form, Card, Button, Container, InputGroup } from '@themesberg/react-bootstrap' import { Link } from 'react-router-dom' // import axios from 'axios' // import { Routes } from '../../routes' import Swal from 'sweetalert2' // import Axios from '../../axios' const ChangePassword = () => { const [Loading, setLoading] = useState(false) const [formData, setFormData] = useState({ oldPassword: '', newPassword: '', }) // console.log(formData); const handleInputChange = (e) => { const { name, value } = e.target setFormData((prevData) => ({ ...prevData, [name]: value })) } const formHandler = async (e) => { e.preventDefault() setLoading(true) // const jwt = localStorage.getItem('jwt') // console.log(jwt); // try { // const response = await Axios.post( // '/api/password', // { // oldPassword: formData.oldPassword, // newPassword: formData.newPassword, // }, // { // headers: { // jwt: `${jwt}`, // 'Content-Type': 'application/json', // }, // }, // ) // // console.log("response ", response); // if (response.status === 200) { // // Display success alert // Swal.fire({ // icon: 'success', // title: 'Password Changed Successfully', // text: 'Your password has been changed successfully!', // }).then((result) => { // if (result.isConfirmed) { // history.push(Routes.Presentation.path) // // history.push(Routes.Dashboard.path); // } // }) // // Redirect to the dashboard // } else { // // Handle other scenarios if needed // Swal.fire({ // icon: 'error', // title: 'Password Change Failed', // text: 'There was an issue changing your password. Please try again.', // }) // } // } catch (err) { // console.log('error is ', err) // Swal.fire({ // icon: 'error', // title: 'Password Change Failed', // text: 'There was an error changing your password. Please try again.', // }) // } setLoading(false) } return (

Back to Dashboard

Change Password

Old Password New Password
) } export default ChangePassword