Skip to content

Commit

Permalink
Only set state if data not null
Browse files Browse the repository at this point in the history
In DEV environment r.data.data might be null which leads to a console
error.
  • Loading branch information
tschumpr committed Jul 29, 2024
1 parent b0b0edc commit 0c3d779
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/client/src/pages/term/accept.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ class AcceptTerms extends React.Component {

componentDidMount() {
getTerms().then(r => {
this.setState({
isFetching: false,
id: r.data.data.id,
en: r.data.data.en,
fr: r.data.data.fr,
de: r.data.data.de,
it: r.data.data.it,
ro: r.data.data.ro,
});
if (r.data.data) {
this.setState({
isFetching: false,
id: r.data.data.id,
en: r.data.data.en,
fr: r.data.data.fr,
de: r.data.data.de,
it: r.data.data.it,
ro: r.data.data.ro,
});
}
});
}

Expand Down

0 comments on commit 0c3d779

Please sign in to comment.