mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Rename RedirectProxyHandler to AuthProxyHandler
This commit is contained in:
parent
04abf31354
commit
12d3fb289e
@ -19,7 +19,7 @@ const { object } = React.PropTypes;
|
||||
* @param {string} options.to Any type of route path that is defined in routes.js
|
||||
* @param {enum/string} options.when ('loggedIn' || 'loggedOut')
|
||||
*/
|
||||
export default function RedirectProxyHandler({to, when}) {
|
||||
export default function AuthProxyHandler({to, when}) {
|
||||
return (Component) => {
|
||||
return React.createClass({
|
||||
propTypes: {
|
@ -19,7 +19,7 @@ import ErrorNotFoundPage from '../../../components/error_not_found_page';
|
||||
import App from './prize_app';
|
||||
import AppConstants from '../../../constants/application_constants';
|
||||
|
||||
import RedirectProxyHandler from '../../../components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
||||
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
||||
|
||||
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
@ -30,26 +30,26 @@ function getRoutes() {
|
||||
<IndexRoute component={Landing} />
|
||||
<Route
|
||||
path='login'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
<Route
|
||||
path='logout'
|
||||
component={RedirectProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
<Route
|
||||
path='signup'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
<Route
|
||||
path='password_reset'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
<Route
|
||||
path='settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
<Route
|
||||
path='register_piece'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(PrizeRegisterPiece)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PrizeRegisterPiece)}
|
||||
headerTitle='+ NEW WORK'/>
|
||||
<Route
|
||||
path='collection'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(PrizePieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PrizePieceList)}
|
||||
headerTitle='COLLECTION'/>
|
||||
|
||||
<Route path='pieces/:pieceId' component={PrizePieceContainer} />
|
||||
|
@ -30,7 +30,7 @@ import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_
|
||||
|
||||
import CCRegisterPiece from './components/cc/cc_register_piece';
|
||||
|
||||
import RedirectProxyHandler from '../../../components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
||||
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
||||
|
||||
import WalletApp from './wallet_app';
|
||||
import AppConstants from '../../../constants/application_constants';
|
||||
@ -44,29 +44,29 @@ let ROUTES = {
|
||||
<IndexRoute component={CylandLanding} />
|
||||
<Route
|
||||
path='login'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
<Route
|
||||
path='logout'
|
||||
component={RedirectProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
<Route
|
||||
path='signup'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
<Route
|
||||
path='password_reset'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
<Route
|
||||
path='settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
<Route
|
||||
path='contract_settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
<Route
|
||||
path='register_piece'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(CylandRegisterPiece)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(CylandRegisterPiece)}
|
||||
headerTitle='+ NEW WORK'/>
|
||||
<Route
|
||||
path='collection'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(CylandPieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(CylandPieceList)}
|
||||
headerTitle='COLLECTION'/>
|
||||
<Route path='editions/:editionId' component={EditionContainer} />
|
||||
<Route path='verify' component={CoaVerifyContainer} />
|
||||
@ -78,29 +78,29 @@ let ROUTES = {
|
||||
<Route path={baseUrl} component={WalletApp}>
|
||||
<Route
|
||||
path='login'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
<Route
|
||||
path='logout'
|
||||
component={RedirectProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
<Route
|
||||
path='signup'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
<Route
|
||||
path='password_reset'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
<Route
|
||||
path='settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
<Route
|
||||
path='contract_settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
<Route
|
||||
path='register_piece'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(CCRegisterPiece)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(CCRegisterPiece)}
|
||||
headerTitle='+ NEW WORK'/>
|
||||
<Route
|
||||
path='collection'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
||||
headerTitle='COLLECTION'/>
|
||||
<Route path='pieces/:pieceId' component={PieceContainer} />
|
||||
<Route path='editions/:editionId' component={EditionContainer} />
|
||||
@ -113,39 +113,39 @@ let ROUTES = {
|
||||
<IndexRoute component={IkonotvLanding} />
|
||||
<Route
|
||||
path='login'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
<Route
|
||||
path='logout'
|
||||
component={RedirectProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
<Route
|
||||
path='signup'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
<Route
|
||||
path='password_reset'
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
<Route
|
||||
path='settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
<Route
|
||||
path='contract_settings'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
<Route
|
||||
path='request_loan'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(ContractAgreementForm)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractAgreementForm)}
|
||||
headerTitle='SEND NEW CONTRACT'
|
||||
aclName='acl_create_contractagreement'/>
|
||||
<Route
|
||||
path='register_piece'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvRegisterPiece)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvRegisterPiece)}
|
||||
headerTitle='+ NEW WORK'
|
||||
aclName='acl_create_piece'/>
|
||||
<Route
|
||||
path='collection'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvPieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvPieceList)}
|
||||
headerTitle='COLLECTION'/>
|
||||
<Route
|
||||
path='contract_notifications'
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvContractNotifications)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(IkonotvContractNotifications)}/>
|
||||
<Route path='pieces/:pieceId' component={IkonotvPieceContainer} />
|
||||
<Route path='editions/:editionId' component={EditionContainer} />
|
||||
<Route path='verify' component={CoaVerifyContainer} />
|
||||
|
18
js/routes.js
18
js/routes.js
@ -25,7 +25,7 @@ import ErrorNotFoundPage from './components/error_not_found_page';
|
||||
|
||||
import RegisterPiece from './components/register_piece';
|
||||
|
||||
import RedirectProxyHandler from './components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
||||
import AuthProxyHandler from './components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
||||
|
||||
import AppConstants from './constants/application_constants';
|
||||
|
||||
@ -36,32 +36,32 @@ let COMMON_ROUTES = (
|
||||
<Route path={baseUrl} component={App}>
|
||||
<Route
|
||||
path="login"
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
|
||||
<Route
|
||||
path="register_piece"
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(RegisterPiece)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(RegisterPiece)}
|
||||
headerTitle="+ NEW WORK"/>
|
||||
<Route
|
||||
path="collection"
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
||||
headerTitle="COLLECTION"/>
|
||||
<Route
|
||||
path="signup"
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
|
||||
<Route
|
||||
path="logout"
|
||||
component={RedirectProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
||||
<Route path="pieces/:pieceId" component={PieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route
|
||||
path="password_reset"
|
||||
component={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
||||
<Route
|
||||
path="settings"
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
|
||||
<Route
|
||||
path="contract_settings"
|
||||
component={RedirectProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
|
||||
<Route path="coa_verify" component={CoaVerifyContainer} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
|
Loading…
Reference in New Issue
Block a user