Skip to content

Commit

Permalink
fix: query null error
Browse files Browse the repository at this point in the history
  • Loading branch information
cyp3rius committed Jan 14, 2021
1 parent a4d214d commit 30dbf17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-comments",
"version": "1.0.1-beta.5",
"version": "1.0.1-beta.6",
"description": "Strapi - Comments plugin",
"strapi": {
"name": "Comments",
Expand All @@ -26,8 +26,8 @@
"reactstrap": "8.4.1",
"redux-saga": "^0.16.0",
"request": "^2.83.0",
"strapi-helper-plugin": "3.1.0",
"strapi-utils": "3.1.0",
"strapi-helper-plugin": "3.4.3",
"strapi-utils": "3.4.3",
"uuid": "^3.1.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions services/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ module.exports = {
...query,
_sort: paginationEnabled ? query._sort || 'created_at:desc' : 'created_at:desc',
};
const entities = query._q ?
const entities = query && query._q ?
await strapi.query( model.modelName, pluginName).search(params, ['authorUser', 'related', 'reports']) :
await strapi.query( model.modelName, pluginName).find(params, ['authorUser', 'related', 'reports']);
const items = entities.map(_ => filterOurResolvedReports(this.sanitizeCommentEntity(_)));
const total = paginationEnabled ?
query._q ?
query && query._q ?
await strapi.query( model.modelName, pluginName).countSearch(params) :
await strapi.query( model.modelName, pluginName).count(params) :
items.length;
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = {
};
}

const entitiesRoot = query._q ?
const entitiesRoot = query && query._q ?
await strapi.query( model.modelName, pluginName)
.search(criteria, ['authorUser', 'related', 'reports']) :
await strapi.query( model.modelName, pluginName)
Expand Down

0 comments on commit 30dbf17

Please sign in to comment.