Ver código fonte

Implemented Hash Tags Filter

Savio Fernando 11 meses atrás
pai
commit
12b81acbe9
1 arquivos alterados com 7 adições e 1 exclusões
  1. 7 1
      src/screens/Search/SearchListPage.js

+ 7 - 1
src/screens/Search/SearchListPage.js

@@ -12,6 +12,11 @@ import ThemedTextButton from '../../components/molecules/Buttons/ThemeTextButton
 import fonts from '../../constants/fonts'
 import HorizontalNewsCardVariant from '../../components/molecules/Cards/HorizontalNewsCardVariant'
 
+const filterMapping = {
+    "hash_tags": "tag",
+    "source":"source",
+    "category":"category"
+}
 
 const SearchListPage = props => {
     const {
@@ -155,10 +160,11 @@ const SearchListPage = props => {
         for (const obj of Object.entries(filterObject)) {
             for (const filter of Object.entries(obj[1])) {
                 if (filter[1] === true) {
-                    filterText += `&${obj[0]}=${category[0]}`
+                    filterText += `&${filterMapping[obj[0]]}=${filter[0]}`
                 }
             }
         }
+        console.log(filterText)
         return filterText
     }