Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

typo of window.fetchWithAuth #3

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ class App extends Component {
</main>
);
}

}

class App extends Component {
app.post('/question/next', function (req, res) {
var req=req+1;
var url='/question/'+String(req)
return res.redirect(url);
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this code? This is not backend :p

export default App;
9 changes: 4 additions & 5 deletions src/QuestionViewer/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* global fetchWithAuth */

import Component from 'inferno-component';
import Component from 'inferno-component';

class QuestionViewer extends Component {
state = {
Expand All @@ -10,7 +8,7 @@ class QuestionViewer extends Component {
}
async componentDidMount() {
const { qno } = this.props.params;
var res = await fetchWithAuth(`/questions/${qno}`);
var res = await window.fetchWithAuth(`/questions/${qno}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a commit with only this line

res = await res.json();
if (!res.error) this.setState({ question: res, loading: false })
else this.setState({ error: res.error, loading: false })
Expand All @@ -25,8 +23,9 @@ class QuestionViewer extends Component {
<p>
{question.body}
</p>
{/* XXX: Need to add previous and next buttons here. Use the Link component from 'inferno-router' */}
<input type="button" class="next" value="NEXT"/>&nbsp;<input type="button" class="prev" value="PREVIOUS"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wont do anything until you bind these buttons or have them as links

</div>

)
}
}
Expand Down