Do not load Grant middleware without user API

This commit is contained in:
loicsaintroch 2016-01-20 16:26:31 +01:00
parent 0609ce7a6c
commit 3bd7d2ea4b

View File

@ -28,6 +28,7 @@ module.exports = function (strapi) {
*/ */
initialize: function (cb) { initialize: function (cb) {
if (_.isPlainObject(strapi.api.user)) {
_.defaultsDeep(strapi.api.user.config.grant, { _.defaultsDeep(strapi.api.user.config.grant, {
server: { server: {
protocol: strapi.config.ssl ? 'https' : 'http', protocol: strapi.config.ssl ? 'https' : 'http',
@ -35,8 +36,8 @@ module.exports = function (strapi) {
} }
}); });
const grant = new Grant(strapi.api.user.config.grant); const grant = new Grant(strapi.api.user.config.grant);
strapi.app.use(strapi.middlewares.mount(grant)); strapi.app.use(strapi.middlewares.mount(grant));
}
cb(); cb();
} }