1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-26 03:06:28 +02:00

Fix some spelling errors in documentation

This commit is contained in:
Tim Daubenschütz 2015-10-12 14:29:31 +02:00
parent a7683a44be
commit 356e0e368a
2 changed files with 9 additions and 10 deletions

View File

@ -22,7 +22,7 @@ const ProxyRoute = React.createClass({
/**
* Generally creating custom `Route`s is not supported by react-router.
*
* However, if we take a look at how `Route`s are declared in the repo,
* However, if we take a look at how `Route`s are declared/generated in their github repo,
* we see that it's fairly straight forward:
* - https://github.com/rackt/react-router/blob/master/modules/Route.js#L21
*
@ -39,7 +39,7 @@ const ProxyRoute = React.createClass({
* - https://github.com/rackt/react-router/blob/master/modules/index.js#L19
*
* Still there is a trick we can use to call this method manually.
* We call `createRoutes`:
* We call the public method `createRoutes`:
* - (https://github.com/rackt/react-router/blob/master/modules/RouteUtils.js#L91)
* which then calls `createRoutesFromReactChildren`
*
@ -47,8 +47,8 @@ const ProxyRoute = React.createClass({
* `element.type.createRouteFromReactElement` is `true` or `false`.
*
* So what we can do is just simply set our element's `type.createRouteFromReactElement`
* to `false`, so that the if statement falls into the methods `else` case and calls
* `createRouteFromReactElement`:
* property to `false`, so that the if statement falls into the methods `else` case
* and calls `createRouteFromReactElement`:
* - https://github.com/rackt/react-router/blob/master/modules/RouteUtils.js#L77
*
* After returning from `createRoutes`, we set `element.type.createRouteFromReactElement`

View File

@ -49,16 +49,16 @@ export default function RedirectProxyHandler({to, when}) {
const { query } = this.props.location;
const { redirectAuthenticated, redirect } = query;
// validate when as an enum, that is either 'loggedIn' or 'loggedOut'.
// validate `when` as an enum, that is either 'loggedIn' or 'loggedOut'.
// Otherwise throw an error.
if(when === 'loggedIn' || when === 'loggedOut') {
// The user of this Handler specifies with `when`, what kind of status
// The user of this handler specifies with `when`, what kind of status
// needs to be checked to conditionally do - if that state is `true` -
// a redirect.
//
// So if when === 'loggedIn', we're checking if the user is logged in and
// vice versa.
// So if when === 'loggedIn', we're checking if the user is logged in (and
// vice versa)
let exprToValidate = when === 'loggedIn' ?
this.state.currentUser && this.state.currentUser.email :
this.state.currentUser && !this.state.currentUser.email;
@ -68,13 +68,12 @@ export default function RedirectProxyHandler({to, when}) {
window.setTimeout(() => this.history.pushState(null, to, query));
// Otherwise there can also be the case that the backend
// wants to redirect the user to a specific case when he's logged out already
// wants to redirect the user to a specific route when the user is logged out already
} else if(!exprToValidate && when === 'loggedIn' && redirect) {
delete query.redirect;
window.setTimeout(() => this.history.pushState(null, '/' + redirect, query));
// and when he's logged in already
} else if(!exprToValidate && when === 'loggedOut' && redirectAuthenticated) {
/*
* redirectAuthenticated contains an arbirary path