0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 19:52: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
};
const [currentError, setCurrentError] = useState(error || null);
const [currentError, setCurrentError] = useState(props.error || null);
const usernameWithS = username + (username.endsWith('s') ? `` : `s`);
const groupedBrews = _.groupBy(brews, (brew)=>brew.published ? 'published' : 'private');
const usernameWithS = props.username + (props.username.endsWith('s') ? `` : `s`);
const groupedBrews = _.groupBy(props.brews, (brew)=>brew.published ? 'published' : 'private');
const brewCollection = [
{
@@ -33,7 +33,7 @@ const UserPage = (props)=>{
class : 'published',
brews : groupedBrews.published || []
},
...(username === global.account?.username ? [{
...(props.username === global.account?.username ? [{
title : `${usernameWithS} unpublished brews`,
class : 'unpublished',
brews : groupedBrews.private || []
@@ -54,7 +54,7 @@ const UserPage = (props)=>{
);
return (
<ListPage brewCollection={brewCollection} navItems={navItems} query={query} reportError={(error)=>setCurrentError(error)} />
<ListPage brewCollection={brewCollection} navItems={navItems} query={props.query} reportError={(err)=>setCurrentError(err)} />
);
};