From 2e17a8f44fb84c411809937ded3b18711a5674d6 Mon Sep 17 00:00:00 2001 From: Michael Midura Date: Fri, 11 Jan 2019 16:57:20 -0800 Subject: [PATCH 1/2] Add ExternalRedirect component scaffold --- merry/src/components/ExternalRedirect/ExternalRedirect.jsx | 0 merry/src/components/ExternalRedirect/index.js | 3 +++ merry/src/components/components.js | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 merry/src/components/ExternalRedirect/ExternalRedirect.jsx create mode 100644 merry/src/components/ExternalRedirect/index.js diff --git a/merry/src/components/ExternalRedirect/ExternalRedirect.jsx b/merry/src/components/ExternalRedirect/ExternalRedirect.jsx new file mode 100644 index 0000000..e69de29 diff --git a/merry/src/components/ExternalRedirect/index.js b/merry/src/components/ExternalRedirect/index.js new file mode 100644 index 0000000..6c23141 --- /dev/null +++ b/merry/src/components/ExternalRedirect/index.js @@ -0,0 +1,3 @@ +import ExternalRedirect from './ExternalRedirect'; + +export default ExternalRedirect; diff --git a/merry/src/components/components.js b/merry/src/components/components.js index 538d1b9..e57cc32 100644 --- a/merry/src/components/components.js +++ b/merry/src/components/components.js @@ -1,6 +1,7 @@ import AbsoluteModal from './AbsoluteModal'; import BlankButton from './BlankButton'; import Button from './Button'; +import ExternalRedirect from './ExternalRedirect'; import Field from './Field'; import FullScreenModal from './FullScreenModal'; import Input from './Input'; @@ -20,6 +21,7 @@ export { AbsoluteModal, BlankButton, Button, + ExternalRedirect, Field, FullScreenModal, Input, From 2590b4c4ab09e56da069fb7a3a085ac833b8f159 Mon Sep 17 00:00:00 2001 From: Michael Midura Date: Fri, 11 Jan 2019 17:01:33 -0800 Subject: [PATCH 2/2] Add ExternalRedirect code --- .../ExternalRedirect/ExternalRedirect.jsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/merry/src/components/ExternalRedirect/ExternalRedirect.jsx b/merry/src/components/ExternalRedirect/ExternalRedirect.jsx index e69de29..a92bf69 100644 --- a/merry/src/components/ExternalRedirect/ExternalRedirect.jsx +++ b/merry/src/components/ExternalRedirect/ExternalRedirect.jsx @@ -0,0 +1,17 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { Route } from 'react-router-dom'; + +const ExternalRedirect = props => { + const { from, to, ...other } = props; + + return (window.location.href = to)} {...other} />; +}; + +ExternalRedirect.propTypes = { + from: PropTypes.string.isRequired, + to: PropTypes.string.isRequired, +}; + +export default ExternalRedirect;