mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Replace AppConstant's baseUrl with appBasePath to be more inline with environment variable
This commit is contained in:
parent
0d05eb17fa
commit
881584111b
@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import UserStore from '../../stores/user_store';
|
||||
@ -10,7 +8,7 @@ import { currentUserShape, locationShape, routerShape, whitelabelShape } from '.
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
|
||||
|
||||
const { bool, object } = React.PropTypes;
|
||||
const { bool } = React.PropTypes;
|
||||
const WHEN_ENUM = ['loggedIn', 'loggedOut'];
|
||||
|
||||
/**
|
||||
@ -50,17 +48,17 @@ export function AuthRedirect({ to, when }) {
|
||||
return true;
|
||||
|
||||
} else if (!exprToValidate && when === 'loggedOut' && redirectAuthenticated) {
|
||||
/*
|
||||
/**
|
||||
* redirectAuthenticated contains an arbitrary path
|
||||
* eg pieces/<id>, editions/<bitcoin_id>, collection, settings, ...
|
||||
* hence transitionTo cannot be used directly.
|
||||
*
|
||||
* While we're getting rid of `query.redirect` explicitly in 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.
|
||||
*/
|
||||
window.location = `${AppConstants.baseUrl}/${redirectAuthenticated}`;
|
||||
window.location = `${AppConstants.appBasePath}/${redirectAuthenticated}`;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const apiEndpoint = process.env.API_URL;
|
||||
const serverUrl = process.env.SERVER_URL;
|
||||
const baseUrl = process.env.APP_BASE_PATH;
|
||||
const appBasePath = process.env.APP_BASE_PATH;
|
||||
|
||||
const constants = {
|
||||
apiEndpoint,
|
||||
baseUrl,
|
||||
appBasePath,
|
||||
serverUrl,
|
||||
'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',
|
||||
@ -98,7 +96,7 @@ const constants = {
|
||||
'sdkUrl': 'https://code.jquery.com/jquery-2.1.4.min.js'
|
||||
},
|
||||
'audiojs': {
|
||||
'sdkUrl': baseUrl + '/static/third_party/audiojs/audio.min.js'
|
||||
'sdkUrl': `${appBasePath}/static/third_party/audiojs/audio.min.js`
|
||||
},
|
||||
'videojs': {
|
||||
'sdkUrl': '//vjs.zencdn.net/4.12/video.js',
|
||||
|
@ -1,11 +1,13 @@
|
||||
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 AppConstants from './constants/application_constants';
|
||||
|
||||
|
||||
const history = useRouterHistory(createBrowserHistory)({
|
||||
basename: AppConstants.baseUrl
|
||||
basename: AppConstants.appBasePath
|
||||
});
|
||||
|
||||
history.locationQueue = [];
|
||||
|
Loading…
Reference in New Issue
Block a user