mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 19:36:20 +00:00
Merge branch 'master' into fix/bookshelf-delete-query
This commit is contained in:
commit
dcb099d151
@ -65,6 +65,20 @@ module.exports = async function() {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Run init functions
|
||||
*/
|
||||
|
||||
// Run beforeInitialize of every middleware
|
||||
await Promise.all(
|
||||
enabledMiddlewares.map(key => {
|
||||
const { beforeInitialize } = this.middleware[key].load;
|
||||
if (typeof beforeInitialize === 'function') {
|
||||
return beforeInitialize();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// run the initialization of an array of middlewares sequentially
|
||||
const initMiddlewaresSeq = async middlewareArr => {
|
||||
for (let key of uniq(middlewareArr)) {
|
||||
@ -91,20 +105,6 @@ module.exports = async function() {
|
||||
middlewaresAfter
|
||||
);
|
||||
|
||||
/**
|
||||
* Run init functions
|
||||
*/
|
||||
|
||||
// Run beforeInitialize of every middleware
|
||||
await Promise.all(
|
||||
enabledMiddlewares.map(key => {
|
||||
const { beforeInitialize } = this.middleware[key].load;
|
||||
if (typeof beforeInitialize === 'function') {
|
||||
return beforeInitialize();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// before
|
||||
await initMiddlewaresSeq(middlewaresBefore);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user