Преглед на файлове

Implemented Hash Tags Filter

Savio Fernando преди 11 месеца
родител
ревизия
12b81acbe9
променени са 1 файла, в които са добавени 7 реда и са изтрити 1 реда
  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
     }