0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-15 06:12:43 +00:00

Fix crash; props need props.var to work

This commit is contained in:
Trevor Buckner
2024-10-26 22:56:29 -04:00
parent f2765650f7
commit 6f2252635a

View File

@@ -22,10 +22,10 @@ const UserPage = (props)=>{
...props ...props
}; };
const [currentError, setCurrentError] = useState(error || null); const [currentError, setCurrentError] = useState(props.error || null);
const usernameWithS = username + (username.endsWith('s') ? `` : `s`); const usernameWithS = props.username + (props.username.endsWith('s') ? `` : `s`);
const groupedBrews = _.groupBy(brews, (brew)=>brew.published ? 'published' : 'private'); const groupedBrews = _.groupBy(props.brews, (brew)=>brew.published ? 'published' : 'private');
const brewCollection = [ const brewCollection = [
{ {
@@ -33,7 +33,7 @@ const UserPage = (props)=>{
class : 'published', class : 'published',
brews : groupedBrews.published || [] brews : groupedBrews.published || []
}, },
...(username === global.account?.username ? [{ ...(props.username === global.account?.username ? [{
title : `${usernameWithS} unpublished brews`, title : `${usernameWithS} unpublished brews`,
class : 'unpublished', class : 'unpublished',
brews : groupedBrews.private || [] brews : groupedBrews.private || []
@@ -54,7 +54,7 @@ const UserPage = (props)=>{
); );
return ( return (
<ListPage brewCollection={brewCollection} navItems={navItems} query={query} reportError={(error)=>setCurrentError(error)} /> <ListPage brewCollection={brewCollection} navItems={navItems} query={props.query} reportError={(err)=>setCurrentError(err)} />
); );
}; };