mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 02:52:38 +00:00
Merge pull request #2297 from jeddai/fix-query-params
update WithRoute to handle query params correctly
This commit is contained in:
@@ -14,13 +14,17 @@ const PrintPage = require('./pages/printPage/printPage.jsx');
|
|||||||
|
|
||||||
const WithRoute = (props)=>{
|
const WithRoute = (props)=>{
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const searchParams = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
|
const queryParams = {};
|
||||||
|
for (const [key, value] of searchParams?.entries() || []) {
|
||||||
|
queryParams[key] = value;
|
||||||
|
}
|
||||||
const Element = props.el;
|
const Element = props.el;
|
||||||
const allProps = {
|
const allProps = {
|
||||||
...props,
|
...props,
|
||||||
...params,
|
...params,
|
||||||
...searchParams,
|
query : queryParams,
|
||||||
el : undefined
|
el : undefined
|
||||||
};
|
};
|
||||||
return <Element {...allProps} />;
|
return <Element {...allProps} />;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user