Made settingsBaseURL global constant

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-01-30 13:51:52 +01:00
parent a49d696c51
commit 22aed6c934
4 changed files with 8 additions and 5 deletions

View File

@ -42,6 +42,7 @@ import App from './containers/App';
import LanguageProvider from './containers/LanguageProvider'; import LanguageProvider from './containers/LanguageProvider';
import configureStore from './configureStore'; import configureStore from './configureStore';
import { SETTINGS_BASE_URL } from './config';
// Import i18n messages // Import i18n messages
import { translationMessages, languages } from './i18n'; import { translationMessages, languages } from './i18n';
@ -64,7 +65,7 @@ Object.keys(plugins).forEach(current => {
const currentPluginFn = plugins[current]; const currentPluginFn = plugins[current];
const plugin = currentPluginFn({ const plugin = currentPluginFn({
registerPlugin, registerPlugin,
settingsBaseURL: '/settings', settingsBaseURL: SETTINGS_BASE_URL,
}); });
const pluginTradsPrefixed = languages.reduce((acc, lang) => { const pluginTradsPrefixed = languages.reduce((acc, lang) => {

View File

@ -8,6 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { get, snakeCase, isEmpty, map, sortBy } from 'lodash'; import { get, snakeCase, isEmpty, map, sortBy } from 'lodash';
import { SETTINGS_BASE_URL } from '../../config';
import LeftMenuLink from '../LeftMenuLink'; import LeftMenuLink from '../LeftMenuLink';
import Wrapper from './Wrapper'; import Wrapper from './Wrapper';
import messages from './messages.json'; import messages from './messages.json';
@ -116,7 +117,7 @@ function LeftMenuLinkContainer({ plugins, ...rest }) {
{ {
icon: 'cog', icon: 'cog',
label: messages.settings.id, label: messages.settings.id,
destination: '/settings', destination: SETTINGS_BASE_URL,
}, },
]; ];

View File

@ -1,3 +1,4 @@
// DO NOT MODIFY THESE OPTIONS // DO NOT MODIFY THESE OPTIONS
export const LOGIN_LOGO = null; export const LOGIN_LOGO = null;
export const SHOW_TUTORIALS = true; export const SHOW_TUTORIALS = true;
export const SETTINGS_BASE_URL = '/settings';

View File

@ -19,7 +19,7 @@ import {
LoadingIndicatorPage, LoadingIndicatorPage,
OverlayBlocker, OverlayBlocker,
} from 'strapi-helper-plugin'; } from 'strapi-helper-plugin';
import { SHOW_TUTORIALS } from '../../config'; import { SETTINGS_BASE_URL, SHOW_TUTORIALS } from '../../config';
import Header from '../../components/Header/index'; import Header from '../../components/Header/index';
import Logout from '../../components/Logout'; import Logout from '../../components/Logout';
@ -150,7 +150,7 @@ export class Admin extends React.Component {
enableGlobalOverlayBlocker={this.props.enableGlobalOverlayBlocker} enableGlobalOverlayBlocker={this.props.enableGlobalOverlayBlocker}
formatMessage={this.props.intl.formatMessage} formatMessage={this.props.intl.formatMessage}
plugins={this.props.global.plugins} plugins={this.props.global.plugins}
settingsBaseURL="/settings" settingsBaseURL={SETTINGS_BASE_URL}
updatePlugin={this.props.updatePlugin} updatePlugin={this.props.updatePlugin}
> >
<Wrapper> <Wrapper>
@ -187,7 +187,7 @@ export class Admin extends React.Component {
render={props => this.renderRoute(props, SettingsPage)} render={props => this.renderRoute(props, SettingsPage)}
/> />
<Route <Route
path="/settings" path={SETTINGS_BASE_URL}
render={props => this.renderRoute(props, SettingsPage)} render={props => this.renderRoute(props, SettingsPage)}
exact exact
/> />