1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Replace AppConstant's baseUrl with appBasePath to be more inline with environment variable

This commit is contained in:
Brett Sun 2016-06-20 10:15:49 +02:00
parent 0d05eb17fa
commit 881584111b
3 changed files with 10 additions and 12 deletions

View File

@ -1,5 +1,3 @@
'use strict';
import React from 'react'; import React from 'react';
import UserStore from '../../stores/user_store'; import UserStore from '../../stores/user_store';
@ -10,7 +8,7 @@ import { currentUserShape, locationShape, routerShape, whitelabelShape } from '.
import AppConstants from '../../constants/application_constants'; import AppConstants from '../../constants/application_constants';
const { bool, object } = React.PropTypes; const { bool } = React.PropTypes;
const WHEN_ENUM = ['loggedIn', 'loggedOut']; const WHEN_ENUM = ['loggedIn', 'loggedOut'];
/** /**
@ -50,17 +48,17 @@ export function AuthRedirect({ to, when }) {
return true; return true;
} else if (!exprToValidate && when === 'loggedOut' && redirectAuthenticated) { } else if (!exprToValidate && when === 'loggedOut' && redirectAuthenticated) {
/* /**
* redirectAuthenticated contains an arbitrary path * redirectAuthenticated contains an arbitrary path
* eg pieces/<id>, editions/<bitcoin_id>, collection, settings, ... * eg pieces/<id>, editions/<bitcoin_id>, collection, settings, ...
* hence transitionTo cannot be used directly. * hence transitionTo cannot be used directly.
* *
* While we're getting rid of `query.redirect` explicitly in the * While we're getting rid of `query.redirect` explicitly in the
* above `else if` statement, here it's sufficient to just set the * above `else if` statement, here it's sufficient to just set the
* location to `${baseUrl}/${redirectAuthenticated}`, as this will * location to `${appBasePath}/${redirectAuthenticated}`, as this will
* get rid of queries as well. * get rid of queries as well.
*/ */
window.location = `${AppConstants.baseUrl}/${redirectAuthenticated}`; window.location = `${AppConstants.appBasePath}/${redirectAuthenticated}`;
return true; return true;
} }

View File

@ -1,12 +1,10 @@
'use strict';
const apiEndpoint = process.env.API_URL; const apiEndpoint = process.env.API_URL;
const serverUrl = process.env.SERVER_URL; const serverUrl = process.env.SERVER_URL;
const baseUrl = process.env.APP_BASE_PATH; const appBasePath = process.env.APP_BASE_PATH;
const constants = { const constants = {
apiEndpoint, apiEndpoint,
baseUrl, appBasePath,
serverUrl, serverUrl,
'aclList': ['acl_coa', 'acl_consign', 'acl_delete', 'acl_download', 'acl_edit', 'acl_create_editions', 'acl_view_editions', 'aclList': ['acl_coa', 'acl_consign', 'acl_delete', 'acl_download', 'acl_edit', 'acl_create_editions', 'acl_view_editions',
'acl_loan', 'acl_loan_request', 'acl_share', 'acl_transfer', 'acl_unconsign', 'acl_unshare', 'acl_view', 'acl_loan', 'acl_loan_request', 'acl_share', 'acl_transfer', 'acl_unconsign', 'acl_unshare', 'acl_view',
@ -98,7 +96,7 @@ const constants = {
'sdkUrl': 'https://code.jquery.com/jquery-2.1.4.min.js' 'sdkUrl': 'https://code.jquery.com/jquery-2.1.4.min.js'
}, },
'audiojs': { 'audiojs': {
'sdkUrl': baseUrl + '/static/third_party/audiojs/audio.min.js' 'sdkUrl': `${appBasePath}/static/third_party/audiojs/audio.min.js`
}, },
'videojs': { 'videojs': {
'sdkUrl': '//vjs.zencdn.net/4.12/video.js', 'sdkUrl': '//vjs.zencdn.net/4.12/video.js',

View File

@ -1,11 +1,13 @@
import useRouterHistory from 'react-router/es6/useRouterHistory'; import useRouterHistory from 'react-router/es6/useRouterHistory';
// History should be included by react-router
// eslint-disable-next-line import/no-extraneous-dependencies
import createBrowserHistory from 'history/lib/createBrowserHistory'; import createBrowserHistory from 'history/lib/createBrowserHistory';
import AppConstants from './constants/application_constants'; import AppConstants from './constants/application_constants';
const history = useRouterHistory(createBrowserHistory)({ const history = useRouterHistory(createBrowserHistory)({
basename: AppConstants.baseUrl basename: AppConstants.appBasePath
}); });
history.locationQueue = []; history.locationQueue = [];