Skip to content

Commit

Permalink
MatchPage Redirect to Onboarding if name or email is not filled out
Browse files Browse the repository at this point in the history
  • Loading branch information
murermader committed Oct 29, 2023
1 parent b47e1c6 commit 24b408a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 13 additions & 2 deletions DineDevineUI/src/pages/MatchPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {
IonButton, IonButtons,
IonContent, IonDatetime,
Expand All @@ -9,13 +9,24 @@ import {
} from '@ionic/react';
import './pages.css'
import { personCircleOutline, personOutline, timeOutline } from 'ionicons/icons';
import {RouteComponentProps} from "react-router";


const MatchPage: React.FC = () => {
const MatchPage: React.FC<RouteComponentProps> = (props: RouteComponentProps) => {
const [numberOfPeople, setNumberOfPeople] = useState(2)
const currentDate = `${new Date().getHours() + 1}`.slice(-4) + ":00"
const [time, setTime] = useState(currentDate)

useEffect(() => {
const name = localStorage.getItem('name');
const email = localStorage.getItem('email');

// Name or E-Mai is not filled out. Go back to onboarding
if(name == null || email == null){
props.history.push("/")
}
}, []);

return (
<IonPage>
<IonHeader>
Expand Down
3 changes: 1 addition & 2 deletions DineDevineUI/src/pages/OnboardingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
IonToolbar,
} from '@ionic/react';
import './pages.css'
import { personCircleOutline, personOutline, timeOutline } from 'ionicons/icons';
import {RouteComponentProps} from "react-router";


Expand All @@ -25,7 +24,7 @@ const OnboardingPage: React.FC<RouteComponentProps> = (props: RouteComponentProp

const [name, setName] = useState("");
const [email, setEmail] = useState("");

const onSubmit = (e) => {
console.log("Save: " + name)
console.log("Save: " + email)
Expand Down

0 comments on commit 24b408a

Please sign in to comment.