From b839ba7870c2872607ebf3ae41a8c08f17a7dde7 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 11 Dec 2018 18:45:25 +0300 Subject: Quality of Frontend Developer's Life: here to stay --- src/boot/after_store.js | 11 ++++++++++- src/main.js | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index a80baaf5..9ce2d7ed 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -38,8 +38,17 @@ const afterStoreSetup = ({store, i18n}) => { return {} }) .then((staticConfig) => { + const overrides = window.___pleromafe_dev_overrides || {} + const env = window.___pleromafe_mode.NODE_ENV + // This takes static config and overrides properties that are present in apiConfig - var config = Object.assign({}, staticConfig, apiConfig) + let config = {} + if (overrides.staticConfigPreference && env === 'DEV') { + console.warn('OVERRIDING API CONFIG WITH STATIC CONFIG') + config = Object.assign({}, apiConfig, staticConfig) + } else { + config = Object.assign({}, staticConfig, apiConfig) + } var theme = (config.theme) var background = (config.background) diff --git a/src/main.js b/src/main.js index 378fe95c..7f3746c8 100644 --- a/src/main.js +++ b/src/main.js @@ -69,3 +69,9 @@ createPersistedState(persistedStateOptions).then((persistedState) => { afterStoreSetup({store, i18n}) }) + +// These are inlined by webpack's DefinePlugin +/* eslint-disable */ +window.___pleromafe_mode = process.env +window.___pleromafe_commit_hash = COMMIT_HASH +window.___pleromafe_dev_overrides = DEV_OVERRIDES -- cgit v1.2.3-70-g09d2 From c54eb1ecad33c4e45868ca35bcaa5404a1bfd0cd Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 11 Dec 2018 19:01:08 +0300 Subject: fix --- src/boot/after_store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 9ce2d7ed..4374ce8e 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -43,7 +43,7 @@ const afterStoreSetup = ({store, i18n}) => { // This takes static config and overrides properties that are present in apiConfig let config = {} - if (overrides.staticConfigPreference && env === 'DEV') { + if (overrides.staticConfigPreference && env === 'development') { console.warn('OVERRIDING API CONFIG WITH STATIC CONFIG') config = Object.assign({}, apiConfig, staticConfig) } else { -- cgit v1.2.3-70-g09d2