MyCrypto/common/components/RedirectWithQuery.tsx
aitrean 626afe554a Forward query arguments during redirect (#990)
* Transfer query arguments over with routing.

* Create a Query Redirect wrapper.

* Add RedirectWithQuery component to SendTransaction index redirect.

* Correct hash-query ordering.
2018-02-08 22:02:56 -06:00

26 lines
557 B
TypeScript

import React from 'react';
import { Redirect } from 'react-router';
interface RouterProps {
from: string;
to: string;
strictArg?: boolean;
exactArg?: boolean;
pushArg?: boolean;
}
export class RedirectWithQuery extends React.Component<RouterProps> {
public render() {
const { from, to, strictArg, exactArg, pushArg } = this.props;
return (
<Redirect
from={from}
to={{ pathname: to, search: window.location.search }}
strict={strictArg}
exact={exactArg}
push={pushArg}
/>
);
}
}