Change pluginRequirements file to requirements

This commit is contained in:
cyril lopez 2017-09-28 14:31:51 +02:00
parent 5a1fae533a
commit a033d97e34
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,3 @@
const shouldRenderCompo = (plugin) => Promise.resolve(plugin);
export default shouldRenderCompo;

View File

@ -0,0 +1,16 @@
import AutoReloadBlocker from 'components/AutoReloadBlocker';
import request from 'utils/request';
const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => {
request('/content-type-builder/autoReload')
.then(response => {
plugin.preventComponentRendering = !response.autoReload;
plugin.blockerComponent = AutoReloadBlocker;
return resolve(plugin);
})
.catch(err => reject(err));
});
export default shouldRenderCompo;

View File

@ -0,0 +1,21 @@
import AutoReloadBlocker from 'components/AutoReloadBlocker';
import ProductionBlocker from 'components/ProductionBlocker';
import request from 'utils/request';
const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => {
request('/settings-manager/autoReload')
.then(response => {
plugin.preventComponentRendering = !response.autoReload;
plugin.blockerComponent = AutoReloadBlocker;
if (response.environment !== 'development') {
plugin.preventComponentRendering = true;
plugin.blockerComponent = ProductionBlocker;
}
return resolve(plugin);
})
.catch(err => reject(err));
});
export default shouldRenderCompo;