Skip to content

Commit

Permalink
Merge pull request #5 from lionix-team/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
GHarutyunyan authored Aug 17, 2019
2 parents 47fb5d1 + a09c8aa commit 2ff67e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-laravel-paginex",
"version": "2.0.3",
"version": "2.0.4",
"description": "Laravel Pagination with ReactJS (customizable)",
"main": "dist/index.js",
"scripts": {
Expand Down
9 changes: 2 additions & 7 deletions src/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@ class Pagination extends Component {
}

componentDidMount() {
this.setState({options: this.props.options, paginationData: this.props.data});
this.getProps(this.props);
}

componentWillReceiveProps(props, nextContext) {
this.setState({options: props.options, paginationData: props.data});
this.getProps(props);
}

// Transform props
getProps = (props) => {
let defaultProps = Pagination.defaultProps.options;
let options = this.state.options;
let options = this.props.options;
Object.keys(defaultProps).forEach(function (key) {
if (!options[key]) {
options[key] = props[key] ? props[key] : defaultProps[key];
}
options[key] = props[key] ? props[key] : props['options'][key] ? props['options'][key] : defaultProps[key];
});
this.setState({options: options, paginationData: props.data});
};
Expand All @@ -47,7 +43,6 @@ class Pagination extends Component {
parameters = this.props.requestParams;
}
parameters.page = page;
console.log('ddd');
this.props.changePage(parameters);
};

Expand Down

0 comments on commit 2ff67e8

Please sign in to comment.