From 516be91519cff524492b5f371f050df9be557cd8 Mon Sep 17 00:00:00 2001 From: Divlo Date: Mon, 4 May 2020 12:58:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20frontend=20/users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FunctionsList/FunctionsList.js | 20 ++-- website/components/Header/Header.js | 1 + website/pages/users/[name].js | 2 +- website/pages/users/index.js | 109 ++++++++++++++++++ website/public/css/pages/users.css | 65 +++++++++++ 5 files changed, 185 insertions(+), 12 deletions(-) create mode 100644 website/pages/users/index.js create mode 100644 website/public/css/pages/users.css diff --git a/website/components/FunctionsList/FunctionsList.js b/website/components/FunctionsList/FunctionsList.js index cd24467..356d014 100644 --- a/website/components/FunctionsList/FunctionsList.js +++ b/website/components/FunctionsList/FunctionsList.js @@ -53,18 +53,16 @@ const FunctionsList = (props) => { if (node) observer.current.observe(node); }, [isLoadingFunctions, functionsData.hasMore]); - const getFunctionsData = () => { + const getFunctionsData = async () => { setLoadingFunctions(true); - return new Promise(async (next) => { - const URL = `${(props.isAdmin) ? "/admin/functions" : "/functions"}?page=${pageFunctions}&limit=10&categoryId=${inputSearch.selectedCategory}&search=${inputSearch.search}`; - const result = await api.get(URL, { - headers: { - ...(props.isAdmin && props.token != undefined) && { 'Authorization': props.token } - } - }); - setLoadingFunctions(false); - next(result.data); + const URL = `${(props.isAdmin) ? "/admin/functions" : "/functions"}?page=${pageFunctions}&limit=10&categoryId=${inputSearch.selectedCategory}&search=${inputSearch.search}`; + const result = await api.get(URL, { + headers: { + ...(props.isAdmin && props.token != undefined) && { 'Authorization': props.token } + } }); + setLoadingFunctions(false); + return result.data; } const handleChange = (event) => { @@ -86,7 +84,7 @@ const FunctionsList = (props) => { ))} - +
diff --git a/website/components/Header/Header.js b/website/components/Header/Header.js index 2e977a0..8dc2c3f 100644 --- a/website/components/Header/Header.js +++ b/website/components/Header/Header.js @@ -37,6 +37,7 @@ export default function Header() {