mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 07:32:40 +00:00
"Removed unnecessary conditional statement in buildBrewsQuery function"
This commit is contained in:
@@ -36,6 +36,7 @@ const handleErrorResponse = (res, error, functionName) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const buildBrewsQuery = (legacy, v3) => {
|
const buildBrewsQuery = (legacy, v3) => {
|
||||||
|
//first off, no need to include renderers, if all are valid
|
||||||
if (legacy === 'true' && v3 === 'true') return { published: true };
|
if (legacy === 'true' && v3 === 'true') return { published: true };
|
||||||
|
|
||||||
const renderers = [];
|
const renderers = [];
|
||||||
@@ -43,7 +44,7 @@ const buildBrewsQuery = (legacy, v3) => {
|
|||||||
if (v3 === 'true') renderers.push('V3');
|
if (v3 === 'true') renderers.push('V3');
|
||||||
|
|
||||||
const brewsQuery = { published: true };
|
const brewsQuery = { published: true };
|
||||||
if (renderers.length > 0) brewsQuery.renderer = { $in: renderers };
|
brewsQuery.renderer = { $in: renderers };
|
||||||
|
|
||||||
return brewsQuery;
|
return brewsQuery;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user