diff --git a/client/src/App.tsx b/client/src/App.tsx index b5f544b..2d77a30 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -2,6 +2,7 @@ import { Route, Routes } from "react-router-dom"; import { AppRoutes } from "@/constants/routes"; import SignUpPage from "@/pages/sign-up/page"; +import SignInPage from "@/pages/sign-in/page"; import RootPage from "@/pages/root/page"; function App() { @@ -10,6 +11,7 @@ function App() { } /> } /> + } /> ); diff --git a/client/src/components/or.tsx b/client/src/components/or.tsx new file mode 100644 index 0000000..13dcdc1 --- /dev/null +++ b/client/src/components/or.tsx @@ -0,0 +1,11 @@ +const Or = () => { + return ( +
+ +

Or

+ +
+ ); +}; + +export { Or }; diff --git a/client/src/components/switch-auth.tsx b/client/src/components/switch-auth.tsx new file mode 100644 index 0000000..9ef91eb --- /dev/null +++ b/client/src/components/switch-auth.tsx @@ -0,0 +1,23 @@ +import { Link } from "react-router-dom"; + +interface SwitchAuthProps { + label: string; + tag: string; + href: string; +} + +const SwitchAuth = ({ label, tag, href }: SwitchAuthProps) => { + return ( +
+

{label}

+ + {tag} + +
+ ); +}; + +export { SwitchAuth }; diff --git a/client/src/constants/collections.ts b/client/src/constants/collections.ts index d13f1b6..4be1ddf 100644 --- a/client/src/constants/collections.ts +++ b/client/src/constants/collections.ts @@ -44,3 +44,24 @@ export const SIGNUPINPUTS = [ validation: ValidateConfirmPassword, }, ]; + +export const SIGNININPUTS = [ + { + name: "email", + label: "Email Address", + placeholder: "e.g. john@domain.com", + type: "email", + autoComplete: "email", + suffixIcon: Mail, + validation: ValidateEmail, + }, + { + name: "password", + label: "Password", + placeholder: "e.g. m#P52s@ap$V", + type: "password", + autoComplete: "new-password", + suffixIcon: Lock, + validation: ValidatePassword, + }, +]; diff --git a/client/src/constants/keys.ts b/client/src/constants/keys.ts index f422536..d12bf38 100644 --- a/client/src/constants/keys.ts +++ b/client/src/constants/keys.ts @@ -1 +1,2 @@ export const SIGNUPKEY = "sign-up"; +export const SIGNINKEY = "sign-in"; diff --git a/client/src/lib/DTO/sign-in.dto.ts b/client/src/lib/DTO/sign-in.dto.ts new file mode 100644 index 0000000..f00864e --- /dev/null +++ b/client/src/lib/DTO/sign-in.dto.ts @@ -0,0 +1,4 @@ +export type SignInDTO = { + email: string; + password: string; +}; diff --git a/client/src/lib/services/auth-service.ts b/client/src/lib/services/auth-service.ts index 8701df5..4611a8c 100644 --- a/client/src/lib/services/auth-service.ts +++ b/client/src/lib/services/auth-service.ts @@ -1,4 +1,5 @@ import { SignUpDTO } from "@/lib/DTO/sign-up.dto"; +import { SignInDTO } from "@/lib/DTO/sign-in.dto"; import { AppRoutes } from "@/constants/routes"; const baseURL = @@ -14,4 +15,11 @@ export const AuthService = { body: JSON.stringify(signUp), }); }, + signIn: async (signIn: SignInDTO) => { + return await fetch(`${baseURL}${AppRoutes.SignIn}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(signIn), + }); + }, }; diff --git a/client/src/pages/root/_components/header/toggle-mode.tsx b/client/src/pages/root/_components/header/toggle-mode.tsx index 5b3024a..e17ca1a 100644 --- a/client/src/pages/root/_components/header/toggle-mode.tsx +++ b/client/src/pages/root/_components/header/toggle-mode.tsx @@ -15,7 +15,7 @@ const ToggleMode = () => { return (