collectionsonline icon indicating copy to clipboard operation
collectionsonline copied to clipboard

Stop HTML/Category specific logic imposing on API calls

Open jamieu opened this issue 7 years ago • 1 comments

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);
            }
          }

jamieu avatar Feb 12 '18 15:02 jamieu

Linked to #1115 .

iteles avatar Mar 11 '19 13:03 iteles