fix things

This commit is contained in:
Vazhin Tayeb
2021-01-17 10:49:25 +03:00
parent 4aa06ce40a
commit 17d147c252
7 changed files with 74 additions and 13 deletions

View File

@@ -5,12 +5,19 @@ import store from "../../store";
import Heading1 from "./Heading1";
import Card from "./Card";
// Services
import { signinRedirect } from "../../services/userService";
const LoginWindow = () => {
const onUserLogin = () => {
const user = { profile: { given_name: "John Doe" } };
console.log(`User logged in!`);
store.dispatch(storeUser(user));
};
// const onUserLogin = () => {
// const user = { profile: { given_name: "John Doe" } };
// console.log(`User logged in!`);
// store.dispatch(storeUser(user));
// };
function login() {
signinRedirect();
}
return (
<Card>
@@ -19,7 +26,7 @@ const LoginWindow = () => {
<p className="text-black-custom font-light text-3xl mb-20">
Login to your account to view your dashboard and register a new vehicle.
</p>
<Button onClickEvent={onUserLogin} text={"Login"} />
<Button onClickEvent={login} text={"Login"} />
</Card>
);
};

View File

@@ -1,5 +1,4 @@
import React from "react";
import { signinRedirect } from "../services/userService";
import { Redirect } from "react-router-dom";
import { useSelector } from "react-redux";
import Navbar from "./components/Navbar";
@@ -9,10 +8,6 @@ import LoginWindow from "./components/LoginWindow";
function Login() {
const user = useSelector((state) => state.auth.user);
function login() {
signinRedirect();
}
return user ? (
<Redirect to={"/"} />
) : (