diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 33a4e59..2f3a5c7 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -4,6 +4,7 @@ import SecretsPage from "./components/pages/secrets"; import ServicesPage from "./components/pages/services"; import LoginPage from "./components/pages/login"; import RequireAuth from "./components/layouts/RequireAuth"; +import UserPage from "./components/pages/user"; export default function App() { return ( @@ -13,6 +14,7 @@ export default function App() { } /> } /> } /> + } /> } /> } /> diff --git a/frontend/src/components/pages/user/index.tsx b/frontend/src/components/pages/user/index.tsx new file mode 100644 index 0000000..f1519a8 --- /dev/null +++ b/frontend/src/components/pages/user/index.tsx @@ -0,0 +1,74 @@ +import { useFormik } from "formik"; +import Button from "../../atoms/Button"; +import Header1 from "../../atoms/Header1"; +import Container from "../../layouts/Container"; +import DashboardLayout from "../../layouts/Dashboard"; +import TextField from "../../molecules/TextField"; + +const UserPage = () => { + const passwordUpdateForm = useFormik({ + initialValues: { oldPassword: "", newPassword: "", confirmPassword: "" }, + onSubmit: async ( + { oldPassword, newPassword, confirmPassword }, + helpers + ) => { + if (newPassword !== confirmPassword) { + helpers.setFieldError("confirmPassword", "Passwords do not match"); + return; + } + + helpers.resetForm(); + }, + }); + + return ( + + + User settings + + Update password + + + + + + + Update + {passwordUpdateForm.errors && ( + {JSON.stringify(passwordUpdateForm.errors)} + )} + + + + + + ); +}; + +export default UserPage;