From b45fe644c5c44f30163b110b9074888bfaf5f0e4 Mon Sep 17 00:00:00 2001 From: Rayhan1998 Date: Mon, 16 May 2022 11:03:00 -0400 Subject: [PATCH 1/2] log out routes back to login page --- .../signInComponent/signInComponent.js | 9 ++++++-- .../signInComponent/signinComponent.css | 10 +++++++++ src/pages/budgetPage/BudgetPage.jsx | 22 ++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 src/components/signInComponent/signinComponent.css diff --git a/src/components/signInComponent/signInComponent.js b/src/components/signInComponent/signInComponent.js index f822fe3..c0457e5 100644 --- a/src/components/signInComponent/signInComponent.js +++ b/src/components/signInComponent/signInComponent.js @@ -2,7 +2,8 @@ import React, { useContext, useState } from "react"; import { Context } from "../../Context"; import { Form, Row, Col, Button } from "react-bootstrap"; import axios from "axios"; -import { useNavigate } from "react-router-dom"; +import { useNavigate, Link } from "react-router-dom"; +import "./signinComponent.css"; // test login // ray@gmail.com @@ -47,7 +48,8 @@ export default function SignInComponent() { console.log("sub"); }; return ( -
+
+

Wallet Zen

@@ -72,6 +74,9 @@ export default function SignInComponent() { + + +
); diff --git a/src/components/signInComponent/signinComponent.css b/src/components/signInComponent/signinComponent.css new file mode 100644 index 0000000..618d83e --- /dev/null +++ b/src/components/signInComponent/signinComponent.css @@ -0,0 +1,10 @@ +.sign-in-header { + text-align: center; +} + +.sign-in-box { + width: 400px; + border: 1px solid green; + height: 400px; + margin: 0 auto; +} diff --git a/src/pages/budgetPage/BudgetPage.jsx b/src/pages/budgetPage/BudgetPage.jsx index f9dec45..04ed32d 100644 --- a/src/pages/budgetPage/BudgetPage.jsx +++ b/src/pages/budgetPage/BudgetPage.jsx @@ -9,10 +9,10 @@ export default function BudgetPage() { const { isLoggedIn, userData, budgetList } = useContext(Context); let navigate = useNavigate(); - console.log("UserID",userData) + console.log("UserID", userData); const loginHandler = () => { if (isLoggedIn) { - window.location.reload(); + navigate("/"); } else { navigate("/"); } @@ -31,7 +31,7 @@ export default function BudgetPage() {

Logo

-

Welcome

+

Welcome {userData.firstname}

@@ -42,13 +42,15 @@ export default function BudgetPage() {

Budget

{budgetList.map((budget, key) => { - return ( - - {budget} - - ); - })} - + return ( + + {budget} + + ); + })} + + +
From 99ed885eaa67e1569be10b75e0f89e82a27e6464 Mon Sep 17 00:00:00 2001 From: Rayhan1998 Date: Mon, 16 May 2022 11:05:29 -0400 Subject: [PATCH 2/2] log out clear all data --- src/pages/budgetPage/BudgetPage.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/budgetPage/BudgetPage.jsx b/src/pages/budgetPage/BudgetPage.jsx index 04ed32d..4d08c0f 100644 --- a/src/pages/budgetPage/BudgetPage.jsx +++ b/src/pages/budgetPage/BudgetPage.jsx @@ -13,6 +13,7 @@ export default function BudgetPage() { const loginHandler = () => { if (isLoggedIn) { navigate("/"); + window.location.reload(); } else { navigate("/"); } @@ -31,7 +32,7 @@ export default function BudgetPage() {

Logo

-

Welcome {userData.firstname}

+

Welcome {userData.firstame}