Skip to content

Commit 2aee811

Browse files
committed
handleSubmit
1 parent 4d6b838 commit 2aee811

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/context.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ const API_ENDPOINT = "https://opentdb.com/api.php?";
1111

1212
const url = "";
1313

14-
const tempUrl =
15-
"https://opentdb.com/api.php?amount=10&category=21&difficulty=easy&type=multiple";
16-
1714
const AppContext = React.createContext();
1815

1916
const AppProvider = ({ children }) => {
@@ -89,6 +86,10 @@ const AppProvider = ({ children }) => {
8986

9087
const handleSubmit = (event) => {
9188
event.preventDefault();
89+
const { amount, category, difficulty } = quiz;
90+
91+
const url = `${API_ENDPOINT}amount=${amount}&difficulty=${difficulty}&category=${table[category]}&type=multiple`;
92+
fetchQuestions(url);
9293
};
9394

9495
return (

0 commit comments

Comments
 (0)