Quellcode durchsuchen

Updated Pagination for API Endpoint

Savio Fernando vor 1 Jahr
Ursprung
Commit
b66e79ada0
2 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 1 1
      src/api/data.js
  2. 1 1
      src/api/urls.js

+ 1 - 1
src/api/data.js

@@ -4,7 +4,7 @@ import { ARTICLE_CATEGORY_URL, ARTICLE_COMMENTS_URL, ARTICLE_DETAIL_URL, ARTICLE
 export const getTrendingNews = () =>  APIHandler.get(TRENDING_URL)
 export const getMenus = () => APIHandler.get(MENUS_URL)
 export const getArticlesByCategory = (category,page = 1) => APIHandler.get(ARTICLE_CATEGORY_URL(category,page))
-export const getArticlesBySearch = (category,page = 1) => APIHandler.get(ARTICLE_SEARCH_URL(category,page))
+export const getArticlesBySearch = (category,page = 1,filters="") => {console.log(ARTICLE_SEARCH_URL(category,page,filters));return APIHandler.get(ARTICLE_SEARCH_URL(category,page,filters))}
 export const getArticleBySlug = (slug) => APIHandler.get(ARTICLE_DETAIL_URL(slug))
 export const getCommentByArticleID = (id) => APIHandler.get(ARTICLE_COMMENTS_URL(id))
 export const getRecommendationByArticleID = (id) => APIHandler.get(ARTICLE_RECOMMENDATIONS_URL(id))

+ 1 - 1
src/api/urls.js

@@ -11,7 +11,7 @@ export const ARTICLE_URL = `article/search/?domain=${DEFAULT_DOMAIN}`
 export const TRENDING_URL = `trending/?domain=${DEFAULT_DOMAIN}`
 export const MENUS_URL =  `menus/?domain=${DEFAULT_DOMAIN}`
 export const ARTICLE_CATEGORY_URL = (category_type,page = 1) =>  `article/search/?domain=${DEFAULT_DOMAIN}&category=${category_type}&page=${page}`
-export const ARTICLE_SEARCH_URL = (search_text,page = 1) =>  `article/search/?domain=${DEFAULT_DOMAIN}&q=${search_text}&page=${page}`
+export const ARTICLE_SEARCH_URL = (search_text,page = 1,filters="") =>  `article/search/?domain=${DEFAULT_DOMAIN}&q=${search_text}&page=${page}${filters}`
 export const ARTICLE_DETAIL_URL = (slug) => `articles/${slug}/?domain=${DEFAULT_DOMAIN}`
 export const ARTICLE_COMMENTS_URL = (id) => `comment/?article_id=${id}`
 export const ARTICLE_RECOMMENDATIONS_URL = (id) => `articles/${id}/recommendations`