QR fontSize; routing
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import {useState,useContext} from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import {UserCtx, UserCtxT} from '../context/UserContext';
|
||||
import './Login.css'
|
||||
|
||||
const Login = () => {
|
||||
const Login = () =>
|
||||
{
|
||||
const {loginUser, wait, getUser, user} = useContext<UserCtxT | null>(UserCtx) as UserCtxT;
|
||||
const [redirect, setRedirect] = useState("false");
|
||||
const [errMsg, setErrMsg] = useState("false");
|
||||
@ -11,6 +12,7 @@ const Login = () => {
|
||||
email:'',
|
||||
password:''
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onChangeInput = (e: React.FormEvent<HTMLInputElement>) =>
|
||||
{
|
||||
@ -23,7 +25,8 @@ const Login = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const submitForm = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
const submitForm = async (e: React.FormEvent<HTMLFormElement>) =>
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if(!Object.values(formData).every(val => val.trim() !== ''))
|
||||
@ -38,7 +41,7 @@ const Login = () => {
|
||||
setRedirect('Redirecting...');
|
||||
setErrMsg(data.message);
|
||||
await getUser();
|
||||
e?.currentTarget?.reset();
|
||||
navigate('/profil');
|
||||
return;
|
||||
}
|
||||
setErrMsg(data.message);
|
||||
|
||||
Reference in New Issue
Block a user