diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx
index e8ea87a9..8e230085 100644
--- a/client/homebrew/pages/archivePage/archivePage.jsx
+++ b/client/homebrew/pages/archivePage/archivePage.jsx
@@ -26,26 +26,22 @@ const ArchivePage = createClass({
//request
title : this.props.query.title || '',
//tags : {},
- legacy : true,
- v3 : true,
- pageSize : 10,
- page : 1,
+ legacy : `${this.props.query.legacy === 'false' ? false : true }`,
+ v3 : `${this.props.query.v3 === 'false' ? false : true }`,
+ pageSize : this.props.query.size || 10,
+ page : this.props.query.page || 1,
//response
brewCollection : null,
totalPages : null,
totalBrews : null,
-
searching : false,
error : null,
};
},
componentDidMount : function() {
-
- },
- handleChange(inputName, e) {
- this.setState({ [inputName]: e.target.value });
+
},
updateStateWithBrews : function (brews, page, totalPages, totalBrews) {
@@ -58,8 +54,22 @@ const ArchivePage = createClass({
});
},
- loadPage : async function(page) {
- this.updateUrl();
+ updateStateWithForm : function() {
+ this.setState({
+ title: document.getElementById( 'title' ).value || "",
+ pageSize: document.getElementById( 'size' ).value || 10,
+ v3: document.getElementById('v3').checked,
+ legacy: document.getElementById('legacy').checked,
+ });
+ },
+
+ loadPage : async function(page, update) {
+ console.log(update);
+ if(update === true) {
+ this.updateStateWithForm();
+ this.updateUrl();
+ };
+
try {
this.setState({ searching: true, error: null });
@@ -75,7 +85,7 @@ const ArchivePage = createClass({
} catch (error) {
console.log(`LoadPage error: ${error}`);
this.setState({ error: `${error}` });
- this.updateStateWithBrews([], 1, 1);
+ this.updateStateWithBrews([], 1, 1, 0);
}
},
@@ -95,9 +105,9 @@ const ArchivePage = createClass({
},
renderPaginationControls() {
- const { page, totalPages,} = this.state;
+ const { page, totalPages} = this.state;
const pages = new Array(totalPages).fill().map((_, index) => (
-
this.loadPage(index+1)}>{index + 1}
+ this.loadPage(index + 1, false)}>{index + 1}
));
if(totalPages === null) {return;}
@@ -107,14 +117,14 @@ const ArchivePage = createClass({
{page > 1 && (
)}
{pages}
{page < totalPages && (
-