2017-09-28 14:31:51 +02:00
|
|
|
import request from 'utils/request';
|
|
|
|
|
|
|
|
const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => {
|
|
|
|
request('/settings-manager/autoReload')
|
|
|
|
.then(response => {
|
|
|
|
plugin.preventComponentRendering = !response.autoReload;
|
2017-09-30 17:20:07 +02:00
|
|
|
plugin.blockerComponentProps = {
|
|
|
|
blockerComponentTitle: 'components.AutoReloadBlocker.header',
|
|
|
|
blockerComponentDescription: 'components.AutoReloadBlocker.description',
|
|
|
|
blockerComponentIcon: 'fa-refresh',
|
|
|
|
blockerComponentContent: 'renderIde',
|
|
|
|
};
|
2017-12-07 16:53:30 +01:00
|
|
|
|
2017-09-28 14:31:51 +02:00
|
|
|
if (response.environment !== 'development') {
|
|
|
|
plugin.preventComponentRendering = true;
|
2017-09-30 17:20:07 +02:00
|
|
|
plugin.blockerComponentProps = {
|
|
|
|
blockerComponentTitle: 'components.ProductionBlocker.header',
|
|
|
|
blockerComponentDescription: 'components.ProductionBlocker.description',
|
|
|
|
blockerComponentIcon: 'fa-ban',
|
|
|
|
blockerComponentContent: 'renderButton',
|
|
|
|
};
|
2017-09-28 14:31:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return resolve(plugin);
|
|
|
|
})
|
|
|
|
.catch(err => reject(err));
|
|
|
|
});
|
|
|
|
|
|
|
|
export default shouldRenderCompo;
|