Skip to content
Open
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
11 changes: 5 additions & 6 deletions src/pages/XxxAnswersPage/XxxAnswersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ class XxxAnswersPage extends React.Component<
componentDidMount() {
this.getQuestionId();
this.getQuestion();
}

componentWillMount() {

// Set up history listener after component is mounted
this.unlisten = this.props.history.listen(() => {
console.log("url changed");
this.getQuestionId();
Expand All @@ -62,7 +61,7 @@ class XxxAnswersPage extends React.Component<
let id: string = "";
let params: XxxAnswersPageSearchParams;
params = this.props.match.params;
if (params.hasOwnProperty("id") && typeof params.id === "string") {
if (Object.prototype.hasOwnProperty.call(params, "id") && typeof params.id === "string") {
this.questionId = params.id;
}
return id;
Expand Down Expand Up @@ -98,7 +97,7 @@ class XxxAnswersPage extends React.Component<
response.json().then(data => {
if (
typeof data === "object" &&
data.hasOwnProperty("items") &&
Object.prototype.hasOwnProperty.call(data, "items") &&
Array.isArray(data.items) &&
data.items.length > 0
) {
Expand Down Expand Up @@ -138,7 +137,7 @@ class XxxAnswersPage extends React.Component<
response.json().then(data => {
if (
typeof data === "object" &&
data.hasOwnProperty("items") &&
Object.prototype.hasOwnProperty.call(data, "items") &&
Array.isArray(data.items) &&
data.items.length > 0
) {
Expand Down
7 changes: 3 additions & 4 deletions src/pages/XxxQuestionsPage/XxxQuestionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ class XxxQuestionsPage extends React.Component<
componentDidMount() {
this.readUrlQueryString(this.props.location.search);
this.getQuestions();
}

componentWillMount() {

// Set up history listener after component is mounted
this.unlisten = this.props.history.listen(location => {
this.readUrlQueryString(location.search);
this.getQuestions();
Expand Down Expand Up @@ -104,7 +103,7 @@ class XxxQuestionsPage extends React.Component<
response.json().then(data => {
if (
typeof data === "object" &&
data.hasOwnProperty("items") &&
Object.prototype.hasOwnProperty.call(data, "items") &&
Array.isArray(data.items) &&
data.items.length > 0
) {
Expand Down