/ common / components / RedirectWithQuery.tsx
RedirectWithQuery.tsx
 1  import React from 'react';
 2  import { Redirect } from 'react-router';
 3  
 4  interface RouterProps {
 5    from: string;
 6    to: string;
 7    strictArg?: boolean;
 8    exactArg?: boolean;
 9    pushArg?: boolean;
10  }
11  
12  export class RedirectWithQuery extends React.Component<RouterProps> {
13    public render() {
14      const { from, to, strictArg, exactArg, pushArg } = this.props;
15      return (
16        <Redirect
17          from={from}
18          to={{ pathname: to, search: window.location.search }}
19          strict={strictArg}
20          exact={exactArg}
21          push={pushArg}
22        />
23      );
24    }
25  }