From ae7326f96f3ca75920b0a1969c6da728510e56c0 Mon Sep 17 00:00:00 2001 From: Sabrina Kuah Date: Fri, 16 Apr 2021 11:32:18 -0700 Subject: [PATCH] Update Search screen dashboard widgets, #110 --- client/src/views/dashboard/Dashboard.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/client/src/views/dashboard/Dashboard.js b/client/src/views/dashboard/Dashboard.js index 7eb5034..8a9b41a 100644 --- a/client/src/views/dashboard/Dashboard.js +++ b/client/src/views/dashboard/Dashboard.js @@ -10,17 +10,19 @@ const Dashboard = ({ children }) => { const [value, onChange] = useState(new Date()); const location = useLocation(); const USER_COMMUNITY_URL = '/user/communities'; + const USER_SEARCH_URL = '/user/communities/search'; const [token] = useLocalStorage('token'); const [community, setCommunity] = useState(null); useEffect(() => { const communityId = location.pathname.substr(18, 35); - // console.log('community ID >>', communityId); + console.log('community ID >>', communityId); // console.log('location', location); communityId && + communityId !== 'search' && (async () => { const response = await getCommunity({ id: communityId, token }); - console.log('community response', response.community); + console.log('community response', response?.community); setCommunity(response.community); })(); }, []); @@ -34,13 +36,15 @@ const Dashboard = ({ children }) => {
- {location.pathname !== USER_COMMUNITY_URL && ( - - )} + {location.pathname !== USER_COMMUNITY_URL && + location.pathname !== USER_SEARCH_URL && ( + + )} - {location.pathname !== USER_COMMUNITY_URL && ( - - )} + {location.pathname !== USER_COMMUNITY_URL && + location.pathname !== USER_SEARCH_URL && ( + + )}