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

@@ -17,7 +17,7 @@
"tailwindcss": "^2.0.2"
},
"scripts": {
"start": "set HTTPS=true set SSL_CRT_FILE=cert.pem set SSL_KEY_FILE=key.pem && react-scripts start",
"start": "HTTPS=true react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"

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={"/"} />
) : (