diff --git a/package.json b/package.json index f0e6a76..08ca373 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "inferno-component": "^3.9.0", "inferno-router": "^3.9.0", "inferno-scripts": "4.2.0", + "linkstate": "^1.1.0", "milligram": "^1.3.0" }, "proxy": "http://localhost:3000", diff --git a/src/QuestionViewer/index.js b/src/QuestionViewer/index.js index e9f10cc..a72172e 100644 --- a/src/QuestionViewer/index.js +++ b/src/QuestionViewer/index.js @@ -1,4 +1,5 @@ import { Link } from 'inferno-router'; +import linkState from 'linkstate'; import Component from 'inferno-component'; class QuestionViewer extends Component { @@ -19,8 +20,13 @@ class QuestionViewer extends Component { if (!res.error) this.setState({ question: res, loading: false }) else this.setState({ error: res.error, loading: false }) } + async checkAnswer() { + // XXX: Need to fill in this stub + // Read fetch documentation on how to send post request and + // display output in window.alert + } render() { - const { loading, question, error } = this.state + const { loading, question, error, answer } = this.state const qno = parseInt(this.props.params.qno,10) return (
@@ -30,6 +36,12 @@ class QuestionViewer extends Component {

{question.body}

+
+ + + +
+
{ qno!==1 && diff --git a/yarn.lock b/yarn.lock index 819b59e..fe1aeb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3934,6 +3934,10 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +linkstate@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/linkstate/-/linkstate-1.1.0.tgz#c84643731c7fcbf2efdee70d23c04e145f84a5a3" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"