collectionsonline
collectionsonline copied to clipboard
Stop HTML/Category specific logic imposing on API calls
https://github.com/TheScienceMuseum/collectionsonline/blob/master/routes/search.js
// match categories if (value.query.q && (!value.categories['filter[categories]'])) { var q = value.query.q.toLowerCase(); var qMatch; if (keyCategories.some(el => { if (el.category === q || el.synonyms.indexOf(q) > -1) { qMatch = el.category; return true; } else { return false; } })) { return reply.redirect(request.path + '/categories/' + qMatch); } }
Linked to #1115 .