mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
re-structure to monorepo.
This commit is contained in:
7
packages/webapp/src/containers/Router/withRoute.tsx
Normal file
7
packages/webapp/src/containers/Router/withRoute.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
// @ts-nocheck
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom"
|
||||
|
||||
export default (mapState) => {
|
||||
return () => withRouter ;
|
||||
};
|
||||
32
packages/webapp/src/containers/Router/withRouteActions.tsx
Normal file
32
packages/webapp/src/containers/Router/withRouteActions.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
// @ts-nocheck
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
||||
const mapDispatchToProps = (dispatch, props) => {
|
||||
return {
|
||||
addQuery: (key, value) => {
|
||||
let pathname = props.location.pathname;
|
||||
let searchParams = new URLSearchParams(props.location.search);
|
||||
|
||||
searchParams.set(key, value);
|
||||
|
||||
props.history.push({
|
||||
pathname: pathname,
|
||||
search: searchParams.toString(),
|
||||
});
|
||||
},
|
||||
|
||||
removeQuery: (key) => {
|
||||
let pathname = props.location.pathname;
|
||||
let searchParams = new URLSearchParams(props.location.search);
|
||||
// returns the existing query string: '?type=fiction&author=fahid'
|
||||
searchParams.delete(key);
|
||||
props.history.push({
|
||||
pathname: pathname,
|
||||
search: searchParams.toString(),
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)
|
||||
Reference in New Issue
Block a user