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,15 +28,16 @@ module.exports = function (strapi) {
*/
initialize: function (cb) {
_.defaultsDeep(strapi.api.user.config.grant, {
server: {
protocol: strapi.config.ssl ? 'https' : 'http',
host: strapi.config.host + ':' + strapi.config.port
}
});
const grant = new Grant(strapi.api.user.config.grant);
strapi.app.use(strapi.middlewares.mount(grant));
if (_.isPlainObject(strapi.api.user)) {
_.defaultsDeep(strapi.api.user.config.grant, {
server: {
protocol: strapi.config.ssl ? 'https' : 'http',
host: strapi.config.host + ':' + strapi.config.port
}
});
const grant = new Grant(strapi.api.user.config.grant);
strapi.app.use(strapi.middlewares.mount(grant));
}
cb();
}