{"version":3,"sources":["services/filter-api.js"],"names":["angular","module","factory","$http","_get","filters","config","dataURL","filterType","key","undefined","url","get","then","response","data","filterStr","val"],"mappings":";;AAAC,aAAY;AAETA,EAAAA,OAAO,CAACC,MAAR,CAAe,WAAf,EAA4B,EAA5B,EACKC,OADL,CACa,WADb,EAC0B,CAAC,OAAD,EAClB,UAAAC,KAAK,EAAI;AAEL;;;;AAIA,QAAMC,IAAI,GAAG,SAAPA,IAAO,CAACC,OAAD,EAAUC,MAAV,EAAqB;AAC9B,UAAMC,OAAO,6BAAuBD,MAAM,CAACE,UAA9B,YAAb;AAEA;;;;;AAIA,UAAIH,OAAO,CAACC,MAAM,CAACG,GAAR,CAAP,IAAuBC,SAA3B,EAAsC;AAClC,YAAMC,GAAG,aAAMJ,OAAN,cAAiBD,MAAM,CAACG,GAAxB,MAAT;AACA,eAAON,KAAK,CAACS,GAAN,CAAUD,GAAV,EACFE,IADE,CACG,UAAAC,QAAQ;AAAA,iBAAIA,QAAQ,CAACC,IAAb;AAAA,SADX,CAAP;AAGH,OALD,MAKO;AACH,YAAIC,SAAS,GAAG,EAAhB;;AACA,aAAK,IAAIP,GAAT,IAAgBJ,OAAhB,EAAyB;AACrB,cAAIY,GAAG,GAAGZ,OAAO,CAACI,GAAD,CAAjB;;AACA,cAAIQ,GAAG,KAAKP,SAAZ,EAAuB;AACnBM,YAAAA,SAAS,cAAOP,GAAP,cAAcQ,GAAd,CAAT;AACH;AACJ;;AAED,eAAOd,KAAK,CAACS,GAAN,WAAaL,OAAb,cAAwBS,SAAxB,GACFH,IADE,CACG,UAAAC,QAAQ;AAAA,iBAAIA,QAAQ,CAACC,IAAb;AAAA,SADX,CAAP;AAEH;AACJ,KAxBD;;AA0BA,WAAO;AACHH,MAAAA,GAAG,EAAER;AADF,KAAP;AAGH,GApCiB,CAD1B;AAyCH,CA3CA,GAAD","sourcesContent":["(function () {\r\n\r\n angular.module('filterApi', [])\r\n .factory('filterApi', ['$http',\r\n $http => {\r\n\r\n /**\r\n * @param { object } filters - filter passed through from controller eg. { c = Public+Sector }\r\n * @param { object } config - config from controller eg { filterType: 'casestudies', key: 'c' }\r\n */\r\n const _get = (filters, config) => {\r\n const dataURL = `/umbraco/xcdapi/${ config.filterType }/filter`;\r\n \r\n /***\r\n * check on page load if there's no query string set\r\n * If not make request with empty query string\r\n */\r\n if (filters[config.key] == undefined) {\r\n const url = `${dataURL}?${config.key}=`;\r\n return $http.get(url)\r\n .then(response => response.data); \r\n\r\n } else {\r\n let filterStr = '';\r\n for (let key in filters) {\r\n let val = filters[key]\r\n if (val !== undefined) {\r\n filterStr += `${key}=${val}`\r\n }\r\n }\r\n\r\n return $http.get(`${dataURL}?${filterStr}`)\r\n .then(response => response.data);\r\n }\r\n }\r\n\r\n return {\r\n get: _get\r\n };\r\n }\r\n ])\r\n\r\n\r\n}());"],"file":"../../services/filter-api.js"}