From 432004f994dcb2ca57a7c2abc2193398d049fff3 Mon Sep 17 00:00:00 2001 From: Steve Yonkeu Date: Thu, 2 Jan 2025 08:53:50 +0100 Subject: [PATCH] fix: fixing deployment issues with amplify --- package-lock.json | 18 ++ package.json | 1 + src/models/password.ts | 6 +- .../auth/forgot-password/Forgot-password.tsx | 248 +++++++++--------- tsconfig.json | 20 ++ vite.config.ts | 1 + 6 files changed, 170 insertions(+), 124 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0e403c..c530106 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "yup": "^1.4.0" }, "devDependencies": { + "@types/node": "^22.10.3", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^6.21.0", @@ -1014,6 +1015,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.3.tgz", + "integrity": "sha512-DifAyw4BkrufCILvD3ucnuN8eydUfc/C1GlyrnI+LK6543w5/L3VeVgf05o3B4fqSXP1dKYLOZsKfutpxPzZrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, "node_modules/@types/prop-types": { "version": "15.7.14", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", @@ -4097,6 +4108,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", diff --git a/package.json b/package.json index 4cef548..0dea2d3 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "yup": "^1.4.0" }, "devDependencies": { + "@types/node": "^22.10.3", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^6.21.0", diff --git a/src/models/password.ts b/src/models/password.ts index 4872a39..8e78a4e 100644 --- a/src/models/password.ts +++ b/src/models/password.ts @@ -1,9 +1,9 @@ export interface ForgotPasswordForm { - email: string + email: string; + code: string; } export interface ResetPasswordForm { - // code :string password: string; confirmPassword: string; -} \ No newline at end of file +} diff --git a/src/pages/auth/forgot-password/Forgot-password.tsx b/src/pages/auth/forgot-password/Forgot-password.tsx index a2e562c..c3aa698 100644 --- a/src/pages/auth/forgot-password/Forgot-password.tsx +++ b/src/pages/auth/forgot-password/Forgot-password.tsx @@ -1,146 +1,152 @@ import {Link, useNavigate} from 'react-router-dom' import * as yup from 'yup'; -import { yupResolver } from '@hookform/resolvers/yup'; -import { AuthImages, HomeImages } from '../../../assets' -import { Button } from '../../../components/layout'; -import { IoIosCheckmark } from 'react-icons/io'; -import { useForm } from 'react-hook-form'; -import { ForgotPasswordForm } from '../../../models'; +import {yupResolver} from '@hookform/resolvers/yup'; +import {AuthImages, HomeImages} from '@/assets' +import {Button} from '@components/layout'; +import {IoIosCheckmark} from 'react-icons/io'; +import {useForm} from 'react-hook-form'; +import {ForgotPasswordForm} from '@/models'; const ForgotPassword = () => { - const navigate = useNavigate() - const ForgotPasswordSchema = yup.object().shape({ - email: yup - .string() - .required('This field is required') - .matches( - /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/, - `${'Enter a valid email'}` - ), - code: yup - .string() - .required('enter a code') - - }); - + const navigate = useNavigate() + const ForgotPasswordSchema = yup.object().shape({ + email: yup + .string() + .required('This field is required') + .matches( + /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/, + `${'Enter a valid email'}` + ), + code: yup + .string() + .required('enter a code'), + } + ); - const { + + const { handleSubmit, register, - formState: { errors }, - } = useForm({ + formState: {errors}, + } = useForm({ resolver: yupResolver(ForgotPasswordSchema), - }); - + }); + - const onSubmit = async (data: ForgotPasswordForm) => { + const onSubmit = async (data: ForgotPasswordForm) => { console.log(data); - }; + }; - return ( -
- - - -
-

Forgot Password

-

- We are very sorry for you losing your password but we got your back. -

-
-
-
-
- -
+ return ( +
+ + + +
+

Forgot Password

+

+ We are very sorry for you losing your password but we got your back. +

+
+
+
+
+ +
-
-
-
- - -
-
+
+ + +
+ +
+
+
-
-
- ); + ); } export default ForgotPassword \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3b10073..cd336be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,6 +23,26 @@ "baseUrl": ".", "paths": { "@/*": ["src/*"], + "@components/*": [ + "src/components/*" + ], + "@utils/*": [ + "src/utils/*" + ], + "@hooks/*": [ + "src/hooks/*" + ], + "@types/*": [ + "src/types/*" + ], + "@assets/*": [ + "src/assets/*" + ], + "@services/*": [ + "src/services/*" + ], + "@features/*": [ + "src/features/*"] }, }, diff --git a/vite.config.ts b/vite.config.ts index 99c7b27..a19e6d8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,6 +8,7 @@ export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "./src"), + '@components': path.resolve(__dirname, './src/components'), }, }, })