added url params to links

This commit is contained in:
Anton Tranelis 2024-07-20 12:29:30 +02:00
parent 6c9311de52
commit eed958f8bc
2 changed files with 5 additions and 3 deletions

View File

@ -41,6 +41,7 @@ export function HeaderView({ item, api, editCallback, deleteCallback, setPositio
const [address, setAdress] = React.useState<string>("");
let params = new URLSearchParams(window.location.search);
const openDeleteModal = async (event: React.MouseEvent<HTMLElement>) => {
@ -91,7 +92,7 @@ export function HeaderView({ item, api, editCallback, deleteCallback, setPositio
</label>
<ul tabIndex={0} className="tw-dropdown-content tw-menu tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-z-1000">
{((api?.updateItem && hasUserPermission(api.collectionName!, "update", item)) || item.layer?.customEditLink) && editCallback && <li>
<a className="!tw-text-base-content tw-cursor-pointer" onClick={(e) => item.layer?.customEditLink ? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? "/" + getValue(item, item.layer.customEditParameter) : ""} `) : editCallback(e)}>
<a className="!tw-text-base-content tw-cursor-pointer" onClick={(e) => item.layer?.customEditLink ? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${getValue(item, item.layer.customEditParameter)}${params && "?"+params}` : ""} `) : editCallback(e)}>
<svg xmlns="http://www.w3.org/2000/svg" className="tw-h-5 tw-w-5" viewBox="0 0 20 20" fill="currentColor">
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z" />
</svg>

View File

@ -249,7 +249,7 @@ export function OverlayItemProfileSettings({ userType }: { userType: string }) {
.then(() => item && updateItem({ ...item, ...changedItem }))
.then(() => {
setLoading(false);
navigate("/item/" + item.id)
navigate(`/item/${item.id}${params && "?"+params}`)
});
}
@ -268,7 +268,7 @@ export function OverlayItemProfileSettings({ userType }: { userType: string }) {
.then(() => item && addItem({ ...item, ...changedItem, layer: item.layer, user_created: user, type: item.layer?.itemType }))
.then(() => {
setLoading(false);
navigate("/")
navigate(`/${params && "?"+params}`)
});
}
}
@ -320,6 +320,7 @@ export function OverlayItemProfileSettings({ userType }: { userType: string }) {
setTemplate(item.layer?.itemType.template || userType);
}, [userType, item])
let params = new URLSearchParams(window.location.search);