mirror of
https://github.com/strapi/strapi.git
synced 2025-09-03 05:39:36 +00:00
Merge pull request #3012 from strapi/fix/events
Remove synchronous way of sending event
This commit is contained in:
commit
a42c2a483c
@ -78,17 +78,15 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
fs.writeFileSync(modelFilePath, JSON.stringify(modelJSON, null, 2), 'utf8');
|
fs.writeFileSync(modelFilePath, JSON.stringify(modelJSON, null, 2), 'utf8');
|
||||||
|
|
||||||
const response = () => {
|
|
||||||
ctx.send({ ok: true });
|
|
||||||
|
|
||||||
strapi.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_.isEmpty(strapi.api)) {
|
if (_.isEmpty(strapi.api)) {
|
||||||
strapi.emit('didCreateFirstContentType', response);
|
strapi.emit('didCreateFirstContentType');
|
||||||
} else {
|
} else {
|
||||||
strapi.emit('didCreateContentType', response);
|
strapi.emit('didCreateContentType');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.send({ ok: true });
|
||||||
|
|
||||||
|
setImmediate(() => strapi.reload());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
strapi.emit('didNotCreateContentType', e);
|
strapi.emit('didNotCreateContentType', e);
|
||||||
return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.write' }] }]);
|
return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.write' }] }]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user