Sfoglia il codice sorgente

Implemented Hash Tags Filter

Savio Fernando 11 mesi fa
parent
commit
12b81acbe9
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  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
     }