slug share workaround

This commit is contained in:
Anton Tranelis 2024-11-07 08:07:13 +01:00
parent ba369e6d80
commit f8f7f485a4
2 changed files with 11 additions and 3 deletions

View File

@ -105,8 +105,8 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
toast.error(error.toString())
}
if (success) {
props.layer.onlyOnePerOwner && item && updateItem({ ...item, ...formItem })
;(!props.layer.onlyOnePerOwner || !item) &&
if (props.layer.onlyOnePerOwner && item) updateItem({ ...item, ...formItem })
if (!props.layer.onlyOnePerOwner || !item) {
addItem({
...formItem,
name: formItem.name ? formItem.name : user?.first_name,
@ -116,6 +116,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
layer: props.layer,
public_edit: !user,
})
}
toast.success('New item created')
resetFilterTags()
}

View File

@ -26,7 +26,14 @@ export const GroupSubHeaderView = ({
)}
</div>
<div>
<SocialShareBar url={shareBaseUrl + item.slug} title={item.name} />
<SocialShareBar
url={
shareBaseUrl && item.slug
? shareBaseUrl + item.slug
: window.location.host + '/item/' + item.id
}
title={item.name}
/>
</div>
</div>
)