From c8552be8b6233755e94f7ae1d9a93ad27851c434 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 14 Sep 2021 08:16:44 +0000 Subject: [PATCH] build sorting and filtering added. --- src/Builds.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Builds.js b/src/Builds.js index 27df106..20ac762 100644 --- a/src/Builds.js +++ b/src/Builds.js @@ -52,15 +52,21 @@ function Builds(p) { const [builds,setBuilds] = useState([]) const [sort,setSort] = useState("date_updated") const [filter,setFilter] = useState("") - const [filter_type,setFilterType] = useState("") + const [filter_type,setFilterType] = useState("author") const [page,setPage] = useState(0) const [finished,setFinished] = useState(false) useEffect(()=>{ + setFinished(false) axios.get(`${BACKENDURL}/getBuilds?sort_type=${sort}${filter_type!==""?`&filter_type=${filter_type}`:""}${filter_type!==""?`&filter=${encodeURI(filter)}`:""}${page!==0?`&offset=${page}`:""}`) .then((data)=>{ setBuilds(data.data) + }) + .catch((err)=>{ + + }) + .finally(()=>{ setFinished(true) }) },[BACKENDURL,sort,filter_type,filter,page]) @@ -70,6 +76,34 @@ function Builds(p) {

Builds List

+
+
+ Sort By: + +
+
+ + +
+
+ {{setFilter(f.currentTarget.value)}} />} +
+
{builds.map((build)=>)}