I have a local App with hardcoded users for login(test purposes), I want to be able to alert a welcome name of the user after successful validation. Hers's what I've done below
const Users = [
{
email: "[email protected]",
password: "admin",
name:"Admin"
},
{
email: "[email protected]",
password: "user123",
name:"Admin2"
},
]
function App() {
const navigate = useNavigate();
const login = (details) => {
const isUserValid = Users.some((user) => {
const email = details.email;
const password = details.password;
return user.email === email && user.password === password;
});
if (isUserValid) {
toast.success( `Welcome ${Users.name}`)
navigate("/");
} else {
toast.error("