2020-04-07 15:00:06 +03:00
|
|
|
import yaml from 'yaml';
|
2018-08-07 14:46:54 -06:00
|
|
|
import { Map, fromJS } from 'immutable';
|
2020-06-18 10:11:37 +03:00
|
|
|
import { trimStart, trim, get, isPlainObject } from 'lodash';
|
2018-08-07 14:46:54 -06:00
|
|
|
import { authenticateUser } from 'Actions/auth';
|
|
|
|
import * as publishModes from 'Constants/publishModes';
|
2018-08-07 10:27:15 -06:00
|
|
|
import { validateConfig } from 'Constants/configSchema';
|
2020-04-01 17:18:56 +03:00
|
|
|
import { selectDefaultSortableFields, traverseFields } from '../reducers/collections';
|
2020-04-01 14:05:02 +03:00
|
|
|
import { resolveBackend } from 'coreSrc/backend';
|
2020-09-20 10:30:46 -07:00
|
|
|
import { I18N, I18N_FIELD } from '../lib/i18n';
|
2016-02-25 00:45:56 -08:00
|
|
|
|
2018-08-07 14:46:54 -06:00
|
|
|
export const CONFIG_REQUEST = 'CONFIG_REQUEST';
|
|
|
|
export const CONFIG_SUCCESS = 'CONFIG_SUCCESS';
|
|
|
|
export const CONFIG_FAILURE = 'CONFIG_FAILURE';
|
|
|
|
export const CONFIG_MERGE = 'CONFIG_MERGE';
|
2018-04-10 16:48:04 -04:00
|
|
|
|
|
|
|
const getConfigUrl = () => {
|
|
|
|
const validTypes = { 'text/yaml': 'yaml', 'application/x-yaml': 'yaml' };
|
|
|
|
const configLinkEl = document.querySelector('link[rel="cms-config-url"]');
|
|
|
|
const isValidLink = configLinkEl && validTypes[configLinkEl.type] && get(configLinkEl, 'href');
|
|
|
|
if (isValidLink) {
|
|
|
|
const link = get(configLinkEl, 'href');
|
|
|
|
console.log(`Using config file path: "${link}"`);
|
|
|
|
return link;
|
|
|
|
}
|
|
|
|
return 'config.yml';
|
2018-08-07 14:46:54 -06:00
|
|
|
};
|
2018-04-10 16:48:04 -04:00
|
|
|
|
2020-04-01 17:18:56 +03:00
|
|
|
const setDefaultPublicFolder = map => {
|
|
|
|
if (map.has('media_folder') && !map.has('public_folder')) {
|
|
|
|
map = map.set('public_folder', map.get('media_folder'));
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
};
|
|
|
|
|
2020-08-31 19:25:48 +08:00
|
|
|
const setSnakeCaseConfig = field => {
|
|
|
|
// Mapping between existing camelCase and its snake_case counterpart
|
|
|
|
const widgetKeyMap = {
|
|
|
|
dateFormat: 'date_format',
|
|
|
|
timeFormat: 'time_format',
|
|
|
|
pickerUtc: 'picker_utc',
|
|
|
|
editorComponents: 'editor_components',
|
|
|
|
valueType: 'value_type',
|
|
|
|
valueField: 'value_field',
|
|
|
|
searchFields: 'search_fields',
|
|
|
|
displayFields: 'display_fields',
|
|
|
|
optionsLength: 'options_length',
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.entries(widgetKeyMap).forEach(([camel, snake]) => {
|
|
|
|
if (field.has(camel)) {
|
|
|
|
field = field.set(snake, field.get(camel));
|
|
|
|
console.warn(
|
|
|
|
`Field ${field.get(
|
|
|
|
'name',
|
|
|
|
)} is using a deprecated configuration '${camel}'. Please use '${snake}'`,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return field;
|
|
|
|
};
|
|
|
|
|
2020-09-20 10:30:46 -07:00
|
|
|
const setI18nField = field => {
|
|
|
|
if (field.get(I18N) === true) {
|
|
|
|
field = field.set(I18N, I18N_FIELD.TRANSLATE);
|
|
|
|
} else if (field.get(I18N) === false || !field.has(I18N)) {
|
|
|
|
field = field.set(I18N, I18N_FIELD.NONE);
|
|
|
|
}
|
|
|
|
return field;
|
|
|
|
};
|
|
|
|
|
|
|
|
const setI18nDefaults = (i18n, collection) => {
|
|
|
|
if (i18n && collection.has(I18N)) {
|
|
|
|
const collectionI18n = collection.get(I18N);
|
|
|
|
if (collectionI18n === true) {
|
|
|
|
collection = collection.set(I18N, i18n);
|
|
|
|
} else if (collectionI18n === false) {
|
|
|
|
collection = collection.delete(I18N);
|
|
|
|
} else {
|
|
|
|
const locales = collectionI18n.get('locales', i18n.get('locales'));
|
|
|
|
const defaultLocale = collectionI18n.get(
|
|
|
|
'default_locale',
|
|
|
|
collectionI18n.has('locales') ? locales.first() : i18n.get('default_locale'),
|
|
|
|
);
|
|
|
|
collection = collection.set(I18N, i18n.merge(collectionI18n));
|
|
|
|
collection = collection.setIn([I18N, 'locales'], locales);
|
|
|
|
collection = collection.setIn([I18N, 'default_locale'], defaultLocale);
|
|
|
|
|
|
|
|
throwOnMissingDefaultLocale(collection.get(I18N));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (collectionI18n !== false) {
|
|
|
|
// set default values for i18n fields
|
|
|
|
collection = collection.set('fields', traverseFields(collection.get('fields'), setI18nField));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
collection = collection.delete(I18N);
|
|
|
|
collection = collection.set(
|
|
|
|
'fields',
|
|
|
|
traverseFields(collection.get('fields'), field => field.delete(I18N)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return collection;
|
|
|
|
};
|
|
|
|
|
|
|
|
const throwOnMissingDefaultLocale = i18n => {
|
|
|
|
if (i18n && !i18n.get('locales').includes(i18n.get('default_locale'))) {
|
|
|
|
throw new Error(
|
|
|
|
`i18n locales '${i18n.get('locales').join(', ')}' are missing the default locale ${i18n.get(
|
|
|
|
'default_locale',
|
|
|
|
)}`,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-11-11 12:17:01 +01:00
|
|
|
const defaults = {
|
|
|
|
publish_mode: publishModes.SIMPLE,
|
|
|
|
};
|
|
|
|
|
2020-08-31 19:25:48 +08:00
|
|
|
export function normalizeConfig(config) {
|
|
|
|
return Map(config).withMutations(map => {
|
|
|
|
map.set(
|
|
|
|
'collections',
|
|
|
|
map.get('collections').map(collection => {
|
|
|
|
const folder = collection.get('folder');
|
|
|
|
if (folder) {
|
|
|
|
collection = collection.set(
|
|
|
|
'fields',
|
|
|
|
traverseFields(collection.get('fields'), setSnakeCaseConfig),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const files = collection.get('files');
|
|
|
|
if (files) {
|
|
|
|
collection = collection.set(
|
|
|
|
'files',
|
|
|
|
files.map(file => {
|
|
|
|
file = file.set('fields', traverseFields(file.get('fields'), setSnakeCaseConfig));
|
|
|
|
return file;
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (collection.has('sortableFields')) {
|
|
|
|
collection = collection
|
|
|
|
.set('sortable_fields', collection.get('sortableFields'))
|
|
|
|
.delete('sortableFields');
|
|
|
|
|
|
|
|
console.warn(
|
|
|
|
`Collection ${collection.get(
|
|
|
|
'name',
|
|
|
|
)} is using a deprecated configuration 'sortableFields'. Please use 'sortable_fields'`,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return collection;
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-11-11 12:17:01 +01:00
|
|
|
export function applyDefaults(config) {
|
2018-02-28 15:45:16 -05:00
|
|
|
return Map(defaults)
|
|
|
|
.mergeDeep(config)
|
|
|
|
.withMutations(map => {
|
2019-03-01 09:45:23 -05:00
|
|
|
// Use `site_url` as default `display_url`.
|
2019-02-08 12:26:59 -05:00
|
|
|
if (!map.get('display_url') && map.get('site_url')) {
|
|
|
|
map.set('display_url', map.get('site_url'));
|
|
|
|
}
|
2019-03-01 09:45:23 -05:00
|
|
|
|
|
|
|
// Use media_folder as default public_folder.
|
2018-02-28 15:45:16 -05:00
|
|
|
const defaultPublicFolder = `/${trimStart(map.get('media_folder'), '/')}`;
|
2020-04-01 13:16:30 +03:00
|
|
|
if (!map.has('public_folder')) {
|
2018-02-28 15:45:16 -05:00
|
|
|
map.set('public_folder', defaultPublicFolder);
|
|
|
|
}
|
2019-03-01 09:45:23 -05:00
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
// default values for the slug config
|
|
|
|
if (!map.getIn(['slug', 'encoding'])) {
|
|
|
|
map.setIn(['slug', 'encoding'], 'unicode');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!map.getIn(['slug', 'clean_accents'])) {
|
|
|
|
map.setIn(['slug', 'clean_accents'], false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!map.getIn(['slug', 'sanitize_replacement'])) {
|
|
|
|
map.setIn(['slug', 'sanitize_replacement'], '-');
|
|
|
|
}
|
|
|
|
|
2020-09-20 10:30:46 -07:00
|
|
|
let i18n = config.get(I18N);
|
|
|
|
i18n = i18n?.set('default_locale', i18n.get('default_locale', i18n.get('locales').first()));
|
|
|
|
throwOnMissingDefaultLocale(i18n);
|
|
|
|
|
2019-03-01 09:45:23 -05:00
|
|
|
// Strip leading slash from collection folders and files
|
|
|
|
map.set(
|
|
|
|
'collections',
|
|
|
|
map.get('collections').map(collection => {
|
2020-03-23 12:01:37 +02:00
|
|
|
if (!collection.has('publish')) {
|
|
|
|
collection = collection.set('publish', true);
|
|
|
|
}
|
|
|
|
|
2019-03-01 09:45:23 -05:00
|
|
|
const folder = collection.get('folder');
|
|
|
|
if (folder) {
|
2019-12-18 18:16:02 +02:00
|
|
|
if (collection.has('path') && !collection.has('media_folder')) {
|
|
|
|
// default value for media folder when using the path config
|
|
|
|
collection = collection.set('media_folder', '');
|
|
|
|
}
|
2020-04-01 17:18:56 +03:00
|
|
|
collection = setDefaultPublicFolder(collection);
|
|
|
|
collection = collection.set(
|
|
|
|
'fields',
|
|
|
|
traverseFields(collection.get('fields'), setDefaultPublicFolder),
|
|
|
|
);
|
2020-06-18 10:11:37 +03:00
|
|
|
collection = collection.set('folder', trim(folder, '/'));
|
|
|
|
if (collection.has('meta')) {
|
|
|
|
const fields = collection.get('fields');
|
|
|
|
const metaFields = [];
|
|
|
|
collection.get('meta').forEach((value, key) => {
|
|
|
|
const field = value.withMutations(map => {
|
|
|
|
map.set('name', key);
|
|
|
|
map.set('meta', true);
|
|
|
|
map.set('required', true);
|
|
|
|
});
|
|
|
|
metaFields.push(field);
|
|
|
|
});
|
|
|
|
collection = collection.set('fields', fromJS([]).concat(metaFields, fields));
|
|
|
|
} else {
|
|
|
|
collection = collection.set('meta', Map());
|
|
|
|
}
|
2020-09-20 10:30:46 -07:00
|
|
|
|
|
|
|
collection = setI18nDefaults(i18n, collection);
|
2019-03-01 09:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const files = collection.get('files');
|
|
|
|
if (files) {
|
2020-09-20 10:30:46 -07:00
|
|
|
if (i18n && collection.has(I18N)) {
|
|
|
|
throw new Error('i18n configuration is not supported for files collection');
|
|
|
|
}
|
2020-06-18 10:11:37 +03:00
|
|
|
collection = collection.delete('nested');
|
|
|
|
collection = collection.delete('meta');
|
2020-04-01 06:13:27 +03:00
|
|
|
collection = collection.set(
|
2019-03-01 09:45:23 -05:00
|
|
|
'files',
|
|
|
|
files.map(file => {
|
2020-04-01 17:18:56 +03:00
|
|
|
file = file.set('file', trimStart(file.get('file'), '/'));
|
|
|
|
file = setDefaultPublicFolder(file);
|
|
|
|
file = file.set(
|
|
|
|
'fields',
|
|
|
|
traverseFields(file.get('fields'), setDefaultPublicFolder),
|
|
|
|
);
|
|
|
|
return file;
|
2019-03-01 09:45:23 -05:00
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
2020-04-01 06:13:27 +03:00
|
|
|
|
2020-08-31 19:25:48 +08:00
|
|
|
if (!collection.has('sortable_fields')) {
|
2020-04-01 14:05:02 +03:00
|
|
|
const backend = resolveBackend(config);
|
2020-04-01 06:13:27 +03:00
|
|
|
const defaultSortable = selectDefaultSortableFields(collection, backend);
|
2020-08-31 19:25:48 +08:00
|
|
|
collection = collection.set('sortable_fields', fromJS(defaultSortable));
|
2020-04-01 06:13:27 +03:00
|
|
|
}
|
|
|
|
|
2020-05-24 17:37:08 +00:00
|
|
|
if (!collection.has('view_filters')) {
|
|
|
|
collection = collection.set('view_filters', fromJS([]));
|
|
|
|
} else {
|
|
|
|
collection = collection.set(
|
|
|
|
'view_filters',
|
|
|
|
collection
|
|
|
|
.get('view_filters')
|
|
|
|
.map(v => v.set('id', `${v.get('field')}__${v.get('pattern')}`)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-01 06:13:27 +03:00
|
|
|
return collection;
|
2019-03-01 09:45:23 -05:00
|
|
|
}),
|
|
|
|
);
|
2018-02-28 15:45:16 -05:00
|
|
|
});
|
2016-11-11 12:17:01 +01:00
|
|
|
}
|
|
|
|
|
2018-02-28 15:45:16 -05:00
|
|
|
function mergePreloadedConfig(preloadedConfig, loadedConfig) {
|
|
|
|
const map = fromJS(loadedConfig) || Map();
|
|
|
|
return preloadedConfig ? preloadedConfig.mergeDeep(map) : map;
|
|
|
|
}
|
|
|
|
|
2020-04-12 19:40:44 +03:00
|
|
|
export function parseConfig(data) {
|
2020-04-10 22:50:05 +01:00
|
|
|
const config = yaml.parse(data, { maxAliasCount: -1, prettyErrors: true, merge: true });
|
2018-08-07 14:46:54 -06:00
|
|
|
if (typeof CMS_ENV === 'string' && config[CMS_ENV]) {
|
|
|
|
Object.keys(config[CMS_ENV]).forEach(key => {
|
2017-04-14 22:36:41 +01:00
|
|
|
config[key] = config[CMS_ENV][key];
|
|
|
|
});
|
2016-11-11 12:17:01 +01:00
|
|
|
}
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2018-03-28 13:25:46 -07:00
|
|
|
async function getConfig(file, isPreloaded) {
|
2018-10-09 13:53:12 -04:00
|
|
|
const response = await fetch(file, { credentials: 'same-origin' }).catch(err => err);
|
|
|
|
if (response instanceof Error || response.status !== 200) {
|
2018-03-28 13:25:46 -07:00
|
|
|
if (isPreloaded) return parseConfig('');
|
2018-10-09 13:53:12 -04:00
|
|
|
throw new Error(`Failed to load config.yml (${response.status || response})`);
|
2018-03-28 13:25:46 -07:00
|
|
|
}
|
|
|
|
const contentType = response.headers.get('Content-Type') || 'Not-Found';
|
|
|
|
const isYaml = contentType.indexOf('yaml') !== -1;
|
|
|
|
if (!isYaml) {
|
2018-08-07 14:46:54 -06:00
|
|
|
console.log(`Response for ${file} was not yaml. (Content-Type: ${contentType})`);
|
2018-03-28 13:25:46 -07:00
|
|
|
if (isPreloaded) return parseConfig('');
|
|
|
|
}
|
|
|
|
return parseConfig(await response.text());
|
|
|
|
}
|
|
|
|
|
2016-02-25 00:45:56 -08:00
|
|
|
export function configLoaded(config) {
|
|
|
|
return {
|
2016-02-25 12:31:21 -08:00
|
|
|
type: CONFIG_SUCCESS,
|
2016-11-11 12:17:01 +01:00
|
|
|
payload: config,
|
2016-02-25 00:45:56 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function configLoading() {
|
|
|
|
return {
|
2016-11-11 12:17:01 +01:00
|
|
|
type: CONFIG_REQUEST,
|
2016-02-25 00:45:56 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function configFailed(err) {
|
|
|
|
return {
|
2016-02-25 12:31:21 -08:00
|
|
|
type: CONFIG_FAILURE,
|
2018-08-07 14:46:54 -06:00
|
|
|
error: 'Error loading config',
|
2016-11-11 12:17:01 +01:00
|
|
|
payload: err,
|
2016-02-25 00:45:56 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-06 21:53:22 -03:00
|
|
|
export function configDidLoad(config) {
|
2018-08-07 14:46:54 -06:00
|
|
|
return dispatch => {
|
2016-06-06 21:53:22 -03:00
|
|
|
dispatch(configLoaded(config));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-28 15:45:16 -05:00
|
|
|
export function mergeConfig(config) {
|
|
|
|
return { type: CONFIG_MERGE, payload: config };
|
|
|
|
}
|
|
|
|
|
2020-02-05 17:56:11 +02:00
|
|
|
export async function detectProxyServer(localBackend) {
|
2020-05-26 11:50:09 +03:00
|
|
|
const allowedHosts = ['localhost', '127.0.0.1', ...(localBackend?.allowed_hosts || [])];
|
|
|
|
if (allowedHosts.includes(location.hostname)) {
|
2020-02-05 17:56:11 +02:00
|
|
|
let proxyUrl;
|
2020-05-26 11:50:09 +03:00
|
|
|
const defaultUrl = 'http://localhost:8081/api/v1';
|
2020-02-05 17:56:11 +02:00
|
|
|
if (localBackend === true) {
|
2020-05-26 11:50:09 +03:00
|
|
|
proxyUrl = defaultUrl;
|
2020-02-05 17:56:11 +02:00
|
|
|
} else if (isPlainObject(localBackend)) {
|
2020-05-26 11:50:09 +03:00
|
|
|
proxyUrl = localBackend.url || defaultUrl.replace('localhost', location.hostname);
|
2020-02-05 17:56:11 +02:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
console.log(`Looking for Netlify CMS Proxy Server at '${proxyUrl}'`);
|
2020-02-10 18:07:52 +02:00
|
|
|
const { repo, publish_modes, type } = await fetch(`${proxyUrl}`, {
|
2020-02-05 17:56:11 +02:00
|
|
|
method: 'POST',
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
body: JSON.stringify({ action: 'info' }),
|
|
|
|
}).then(res => res.json());
|
2020-02-10 18:07:52 +02:00
|
|
|
if (typeof repo === 'string' && Array.isArray(publish_modes) && typeof type === 'string') {
|
2020-02-05 17:56:11 +02:00
|
|
|
console.log(`Detected Netlify CMS Proxy Server at '${proxyUrl}' with repo: '${repo}'`);
|
2020-02-10 18:07:52 +02:00
|
|
|
return { proxyUrl, publish_modes, type };
|
2020-02-05 17:56:11 +02:00
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
console.log(`Netlify CMS Proxy Server not detected at '${proxyUrl}'`);
|
|
|
|
}
|
|
|
|
}
|
2020-02-10 18:07:52 +02:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function handleLocalBackend(mergedConfig) {
|
|
|
|
if (mergedConfig.has('local_backend')) {
|
|
|
|
const { proxyUrl, publish_modes, type } = await detectProxyServer(
|
|
|
|
mergedConfig.toJS().local_backend,
|
|
|
|
);
|
|
|
|
if (proxyUrl) {
|
|
|
|
mergedConfig = mergePreloadedConfig(mergedConfig, {
|
|
|
|
backend: { name: 'proxy', proxy_url: proxyUrl },
|
|
|
|
});
|
|
|
|
if (
|
|
|
|
mergedConfig.has('publish_mode') &&
|
|
|
|
!publish_modes.includes(mergedConfig.get('publish_mode'))
|
|
|
|
) {
|
|
|
|
const newPublishMode = publish_modes[0];
|
|
|
|
console.log(
|
|
|
|
`'${mergedConfig.get(
|
|
|
|
'publish_mode',
|
|
|
|
)}' is not supported by '${type}' backend, switching to '${newPublishMode}'`,
|
|
|
|
);
|
|
|
|
mergedConfig = mergePreloadedConfig(mergedConfig, {
|
|
|
|
publish_mode: newPublishMode,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mergedConfig;
|
2020-02-05 17:56:11 +02:00
|
|
|
}
|
|
|
|
|
2016-11-11 12:17:01 +01:00
|
|
|
export function loadConfig() {
|
2016-02-25 00:45:56 -08:00
|
|
|
if (window.CMS_CONFIG) {
|
2018-02-28 15:45:16 -05:00
|
|
|
return configDidLoad(fromJS(window.CMS_CONFIG));
|
2016-02-25 00:45:56 -08:00
|
|
|
}
|
2018-02-28 15:45:16 -05:00
|
|
|
return async (dispatch, getState) => {
|
2016-02-25 00:45:56 -08:00
|
|
|
dispatch(configLoading());
|
|
|
|
|
2018-02-28 15:45:16 -05:00
|
|
|
try {
|
|
|
|
const preloadedConfig = getState().config;
|
2018-04-10 16:48:04 -04:00
|
|
|
const configUrl = getConfigUrl();
|
2020-02-05 17:56:11 +02:00
|
|
|
const isPreloaded = preloadedConfig && preloadedConfig.size > 1;
|
2019-02-03 14:48:40 -08:00
|
|
|
const loadedConfig =
|
|
|
|
preloadedConfig && preloadedConfig.get('load_config_file') === false
|
|
|
|
? {}
|
2020-02-05 17:56:11 +02:00
|
|
|
: await getConfig(configUrl, isPreloaded);
|
2018-02-28 15:45:16 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Merge any existing configuration so the result can be validated.
|
|
|
|
*/
|
2020-02-05 17:56:11 +02:00
|
|
|
let mergedConfig = mergePreloadedConfig(preloadedConfig, loadedConfig);
|
|
|
|
|
2018-08-07 10:27:15 -06:00
|
|
|
validateConfig(mergedConfig.toJS());
|
|
|
|
|
2020-02-10 18:07:52 +02:00
|
|
|
mergedConfig = await handleLocalBackend(mergedConfig);
|
2020-02-05 17:56:11 +02:00
|
|
|
|
2020-08-31 19:25:48 +08:00
|
|
|
const config = applyDefaults(normalizeConfig(mergedConfig));
|
2018-02-28 15:45:16 -05:00
|
|
|
|
2017-04-14 17:12:13 +01:00
|
|
|
dispatch(configDidLoad(config));
|
|
|
|
dispatch(authenticateUser());
|
2018-08-07 14:46:54 -06:00
|
|
|
} catch (err) {
|
2016-02-25 00:45:56 -08:00
|
|
|
dispatch(configFailed(err));
|
2018-08-07 14:46:54 -06:00
|
|
|
throw err;
|
2018-02-28 15:45:16 -05:00
|
|
|
}
|
2016-02-25 00:45:56 -08:00
|
|
|
};
|
|
|
|
}
|