This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function checkBoarded(Component, { withValue, redirectTo }) { | |
class CompletedComponent extends React.Component { | |
static propTypes = { | |
state: PropTypes.object.isRequired, | |
dispatch: PropTypes.func.isRequired | |
}; | |
componentDidMount() { | |
this._checkAndRedirect(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_checkAndRedirect() { | |
const { dispatch, user } = this.props; | |
const { role, redirectTo } = options; | |
if (!user || !user.role === role) { | |
dispatch(push(redirectTo || '/signin')); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Route path="/app" component={requiresAuth(App, { role: 'user', redirectTo: '/signin' })}> | |
<Route name="dashboard" path="dashboard" component={Dashboard} /> | |
<Route name="invoices" path="user-profile" component={UserProfile} /> | |
</Route> | |
<Route path="/config" component={requiresAuth(Config, { role: 'admin', redirectTo: '/app' })}> | |
<Route name="page" path="page" component={PageConfig} /> | |
</Route> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const routes = ( | |
<Route path=""> | |
<Route path="/signup" component={SignUp} /> | |
<Route path="/signin" component={SignIn} /> | |
<Route path="/welcome-on-board" component={Welcome} /> | |
<Route path="/forgot-password" component={ForgotPassword} /> | |
<Route path="/signout" component={SignOut} /> /* App component is wrapped | |
with requiresAuth() */ | |
<Route path="/app" component={requiresAuth(App)}> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react'; | |
import { connect } from 'react-redux'; | |
import { push } from 'react-router-redux'; | |
export default function requiresAuth(Component) { | |
class AuthenticatedComponent extends React.Component { | |
static propTypes = { | |
user: PropTypes.object, | |
dispatch: PropTypes.func.isRequired, | |
}; | |
componentDidMount() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const routes = ( | |
<Route path=""> | |
{' '} | |
<Route path="/signup" component={SignUp} />{' '} | |
<Route path="/signin" component={SignIn} />{' '} | |
<Route path="/welcome-on-board" component={Welcome} />{' '} | |
<Route path="/forgot-password" component={ForgotPassword} />{' '} | |
<Route path="/signout" component={SignOut} />{' '} | |
<Route path="/" component={App}> | |
{' '} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import domain from '../../domain'; | |
const Handler = { | |
getGroups: (request, reply) => { | |
const groups = domain.groups(request, reply); | |
return Promise.resolve() | |
.then(groups.getGroups) | |
.then(groups.transformMany) | |
.then(groups.reply); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const methodOverride = require('method-override'); | |
const morgan = require('morgan'); | |
const cors = require('cors'); | |
const health = require('express-ping'); | |
const config = require('./config'); | |
const middleware = require('./source/middleware'); | |
const logger = require('./source/utils/logger'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from 'react'; | |
class OutsideClick extends Component { | |
static propTypes = { | |
children: PropTypes.any, | |
onClick: PropTypes.func.isRequired, | |
id: PropTypes.string, | |
tag: PropTypes.string, | |
className: PropTypes.string | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { actionRequest, requestFlow } from '../utils/axios'; | |
import { push } from 'react-router-redux'; | |
import constants from '../constants'; | |
export function requestAuthUrl() { | |
return (dispatch) => { | |
const onBefore = () => { | |
dispatch({ type: constants.ACCOUNT_REQUESTING_AUTH_URL }); | |
}; |