Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ui' of https://github.com/mostafa-elhaiany/DineDevine i…
…nto ui
- Loading branch information
Showing
4 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar, IonItem, IonLabel } from '@ionic/react'; | ||
|
||
const IcebreakerPage = ({ match }) => { | ||
const [questions, setQuestions] = useState([]); | ||
|
||
useEffect(() => { | ||
const id1 = match.params.id1; | ||
const id2 = match.params.id2; | ||
|
||
// Make a GET request to the API with the provided IDs | ||
fetch(`/matches/icebreaker/${id1}/${id2}`) | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
setQuestions(data.questions); // Assuming the API response is an object with a "questions" property | ||
}) | ||
.catch((error) => { | ||
console.error('Error fetching data:', error); | ||
}); | ||
}, [match.params.id1, match.params.id2]); | ||
|
||
return ( | ||
<IonPage> | ||
<IonHeader> | ||
<IonToolbar> | ||
<IonTitle>Match Questions</IonTitle> | ||
</IonToolbar> | ||
</IonHeader> | ||
|
||
<IonContent> | ||
<IonList> | ||
{questions.map((question, index) => ( | ||
<IonItem key={index}> | ||
<IonLabel>{question}</IonLabel> | ||
</IonItem> | ||
))} | ||
</IonList> | ||
</IonContent> | ||
</IonPage> | ||
); | ||
}; | ||
|
||
export default IcebreakerPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.