fix: static page reload fails, use search param device id, close #1711

This commit is contained in:
Maxi Quoß
2026-03-21 01:21:35 +01:00
parent 85b49defa9
commit 105ae4f6bc
3 changed files with 4 additions and 4 deletions

View File

@@ -44,7 +44,7 @@
{
text: m.device_card_btn_more_edit(),
icon: faPen,
onClick: () => goto(resolve(`/device/${device.id}`)),
onClick: () => goto(resolve(`/device?id=${device.id}`)),
requires: $pocketbase.authStore.isSuperuser || $permission.update?.includes(device.id)
}
]);

View File

@@ -11,7 +11,7 @@
$effect(() => {
if (Object.hasOwn($permission, 'update')) {
const id = page.params.id;
const id = page.url.searchParams.get('id');
if (!$pocketbase.authStore.isSuperuser && !$permission.update.includes(id || '')) {
toast(m.toasts_no_permission({ url: page.url.pathname }), {
icon: '⛔'
@@ -22,7 +22,7 @@
});
async function getDevice(): Promise<Device> {
const id = page.params.id;
const id = page.url.searchParams.get('id');
if (!id) throw new Error('No device ID provided');
const resp = await $pocketbase.collection('devices').getOne(id, { expand: 'ports,groups' });

View File

@@ -18,7 +18,7 @@ const config = {
'/login',
'/account',
'/welcome',
'/device/[id]',
'/device',
'/device/new',
'/users',
'/settings'