Skip to content

Commit

Permalink
add fix for is add to index
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaStelmashchuk committed Sep 20, 2024
1 parent 0ea674b commit 0f1f3f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions features/filters/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const router = express.Router();
router.get('/api/filter/*', async (req, res) => {
//Getting query sort=most-popular&page=0
const sortType = req.query.sort;
const isRequestHasQuery = Object.keys(req.query).length > 0;

const page = req.query.page || 0;

const start = page * 24;
Expand All @@ -26,6 +28,10 @@ router.get('/api/filter/*', async (req, res) => {
}

const response = await getFullCocktailByFilter(filter, start, limit, sortType);

if (isRequestHasQuery) {
response.isAddToIndex = false;
}

const descriptionBuilder = new DescriptionBuilder();
const description = await descriptionBuilder.buildDescription(filter);
Expand Down

0 comments on commit 0f1f3f5

Please sign in to comment.