From 2ca65512230dde763b1e8c35fa5d06d7d6d71f0e Mon Sep 17 00:00:00 2001 From: Pob <590650@gmail.com> Date: Tue, 23 Oct 2018 17:17:43 +0700 Subject: [PATCH 1/2] remove unnecessary regex search --- _chapters/redirect-on-login.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_chapters/redirect-on-login.md b/_chapters/redirect-on-login.md index 8d8cb17ad..cab987bbd 100644 --- a/_chapters/redirect-on-login.md +++ b/_chapters/redirect-on-login.md @@ -15,9 +15,7 @@ Let's start by adding a method to read the `redirect` URL from the querystring. ``` coffee function querystring(name, url = window.location.href) { - name = name.replace(/[[]]/g, "\\$&"); - - const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"); + const regex = new RegExp("[?&]" + name + "(=([^&#]*))", "i"); const results = regex.exec(url); if (!results) { @@ -27,7 +25,7 @@ function querystring(name, url = window.location.href) { return ""; } - return decodeURIComponent(results[2].replace(/\+/g, " ")); + return decodeURI(results[2].replace(/\+/g, " ")); } ``` From 567ca6b3ef4cf2ad5e2de21cd48ac23c8fb098e8 Mon Sep 17 00:00:00 2001 From: Pob <590650@gmail.com> Date: Tue, 23 Oct 2018 22:51:03 +0700 Subject: [PATCH 2/2] edited the tutorial content --- _chapters/redirect-on-login.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_chapters/redirect-on-login.md b/_chapters/redirect-on-login.md index cab987bbd..0fba81186 100644 --- a/_chapters/redirect-on-login.md +++ b/_chapters/redirect-on-login.md @@ -52,7 +52,7 @@ export default ({ component: C, props: cProps, ...rest }) => { }; ``` -And remove the following from the `handleSubmit` method in `src/containers/Login.js`. +And remove the following from the `handleSubmit` method in `src/containers/Login.js` and from the `handleConfirmationSubmit` method in `src/containers/Signup.js`. ``` coffee this.props.history.push("/");