mirror of
https://github.com/strapi/strapi.git
synced 2025-08-14 03:34:53 +00:00
22 lines
687 B
JavaScript
22 lines
687 B
JavaScript
![]() |
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;
|