mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +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 = () => { |         if (_.isEmpty(strapi.api)) { | ||||||
|  |           strapi.emit('didCreateFirstContentType'); | ||||||
|  |         } else { | ||||||
|  |           strapi.emit('didCreateContentType'); | ||||||
|  |         } | ||||||
|  |          | ||||||
|         ctx.send({ ok: true }); |         ctx.send({ ok: true }); | ||||||
|          |          | ||||||
|           strapi.reload(); |         setImmediate(() => strapi.reload()); | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         if (_.isEmpty(strapi.api)) { |  | ||||||
|           strapi.emit('didCreateFirstContentType', response); |  | ||||||
|         } else { |  | ||||||
|           strapi.emit('didCreateContentType', response); |  | ||||||
|         } |  | ||||||
|       } 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
	 Alexandre BODIN
						Alexandre BODIN