Fix 500 on non-existant group page
This commit is contained in:
parent
68120ec2b2
commit
bf92c4fb06
|
@ -122,7 +122,7 @@ const groupSubpages = [
|
||||||
export default function GroupPage(props: {
|
export default function GroupPage(props: {
|
||||||
group: Group | null
|
group: Group | null
|
||||||
memberIds: string[]
|
memberIds: string[]
|
||||||
creator: User
|
creator: User | null
|
||||||
topTraders: { user: User; score: number }[]
|
topTraders: { user: User; score: number }[]
|
||||||
topCreators: { user: User; score: number }[]
|
topCreators: { user: User; score: number }[]
|
||||||
messages: GroupComment[]
|
messages: GroupComment[]
|
||||||
|
@ -163,11 +163,11 @@ export default function GroupPage(props: {
|
||||||
const memberIds = useMemberIds(group?.id ?? null) ?? props.memberIds
|
const memberIds = useMemberIds(group?.id ?? null) ?? props.memberIds
|
||||||
|
|
||||||
useSaveReferral(user, {
|
useSaveReferral(user, {
|
||||||
defaultReferrerUsername: creator.username,
|
defaultReferrerUsername: creator?.username,
|
||||||
groupId: group?.id,
|
groupId: group?.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (group === null || !groupSubpages.includes(page) || slugs[2]) {
|
if (group === null || !groupSubpages.includes(page) || slugs[2] || !creator) {
|
||||||
return <Custom404 />
|
return <Custom404 />
|
||||||
}
|
}
|
||||||
const isCreator = user && group && user.id === group.creatorId
|
const isCreator = user && group && user.id === group.creatorId
|
||||||
|
|
Loading…
Reference in New Issue
Block a user