diff --git a/src/pages/_app.js b/src/pages/_app.js
index a594dc7..76ddcde 100644
--- a/src/pages/_app.js
+++ b/src/pages/_app.js
@@ -3,10 +3,10 @@
import '../defaultStyles.css'
import Layout from '../components/layout'
-function MyApp ({ Component, pageProps, router }) {
+function MyApp({ Component, pageProps, router }) {
return (
-
+
)
}
diff --git a/src/pages/allQuestions.js b/src/pages/allQuestions.js
index d2995c8..97ca759 100644
--- a/src/pages/allQuestions.js
+++ b/src/pages/allQuestions.js
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'
+import Link from 'next/link'
import fetch from 'unfetch'
import LoadingIndicator from '../components/LoadingIndicator.js'
@@ -7,13 +8,13 @@ import QuestionSearchResult from '../components/QuestionSearchResult.js'
import styles from './allQuestions.module.css'
import constants from '../constants.json'
-export default function AllQuestions (props) {
+export default function AllQuestions({ router }) {
const [data, setData] = useState(null)
const [searchTerm, setSearchTerm] = useState('')
useEffect(() => {
fetch(`${constants.apiUrl}data.json`, {
- credentials: 'include'
+ credentials: 'include',
})
.then((resp) => {
return resp.json()
@@ -21,6 +22,7 @@ export default function AllQuestions (props) {
.then((data) => {
setData(data)
})
+ setSearchTerm(router.query.q ? decodeURIComponent(router.query.q) : '')
}, [])
if (data) {
@@ -28,11 +30,19 @@ export default function AllQuestions (props) {
)
} else {
- return (
-
- )
+ return
}
}