From 42eeac8d2a0c8af8106a10d5dcd56609e7363840 Mon Sep 17 00:00:00 2001 From: bsquillari Date: Wed, 29 Nov 2023 04:18:12 +0000 Subject: [PATCH] Add signup and login btns --- browser-domain/src/components/LogIn/LogIn.tsx | 10 ++++++++++ browser-domain/src/components/SignUp/SignUp.tsx | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/browser-domain/src/components/LogIn/LogIn.tsx b/browser-domain/src/components/LogIn/LogIn.tsx index f42b772..81a88c6 100644 --- a/browser-domain/src/components/LogIn/LogIn.tsx +++ b/browser-domain/src/components/LogIn/LogIn.tsx @@ -1,11 +1,13 @@ import React, { useState } from "react"; import { Button, Input } from "antd"; import useAuth from "../../useAuth"; +import { useNavigate } from "react-router"; export const LogIn = () => { const { login, loading, error } = useAuth(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); + const navigate = useNavigate(); return (
@@ -28,6 +30,14 @@ export const LogIn = () => { > Log in + {error ? (
{error}
) : ( diff --git a/browser-domain/src/components/SignUp/SignUp.tsx b/browser-domain/src/components/SignUp/SignUp.tsx index 0cd1323..909add1 100644 --- a/browser-domain/src/components/SignUp/SignUp.tsx +++ b/browser-domain/src/components/SignUp/SignUp.tsx @@ -1,12 +1,14 @@ import React, { useState } from "react"; import { Button, Input } from "antd"; import { useCreateUser } from "../../hooks/useCreateUser"; +import { useNavigate } from "react-router"; export const SignUp = () => { const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [repeatPassword, setRepeatPassword] = useState(""); + const navigate = useNavigate(); const { createUser, isLoading, error } = useCreateUser(); @@ -46,6 +48,14 @@ export const SignUp = () => { > Sign up + {error ? (
{error}
) : (