Skip to content

Commit

Permalink
Update on issue worknenjoy#630
Browse files Browse the repository at this point in the history
Currently, when the page reloads, it starts from 'this.state.page = 0'. The concept of this modification is to update the url with the current page number and to use this value for 'this.state.page' when the page reloads during back button press.
  • Loading branch information
Asaye authored Apr 22, 2020
1 parent 76e3dad commit 1621cf6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/components/task/task-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class CustomPaginationActionsTable extends React.Component {

handleChangePage = (event, page) => {
this.setState({ page })
this.props.history.replace('/profile/tasks/' + page)
};

handleChangeRowsPerPage = event => {
Expand All @@ -172,6 +173,12 @@ class CustomPaginationActionsTable extends React.Component {
handleClickListItem = id => {
this.props.history.push('/task/' + id)
}

componentDidMount() {
const path = window.location.pathname.split("/");
const index = path.indexOf("tasks") + 1;
this.setState({ page: parseInt(path[index]) });
}

render () {
const { classes, tasks } = this.props
Expand Down

0 comments on commit 1621cf6

Please sign in to comment.