Skip to content

change a regex and contents on Redirect on login chapter #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions _chapters/redirect-on-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -27,7 +25,7 @@ function querystring(name, url = window.location.href) {
return "";
}

return decodeURIComponent(results[2].replace(/\+/g, " "));
return decodeURI(results[2].replace(/\+/g, " "));
}
```

Expand All @@ -54,7 +52,7 @@ export default ({ component: C, props: cProps, ...rest }) => {
};
```

<img class="code-marker" src="/assets/s.png" />And remove the following from the `handleSubmit` method in `src/containers/Login.js`.
<img class="code-marker" src="/assets/s.png" />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("/");
Expand Down