fix error messages, switch to state overview data instead of importing

it
This commit is contained in:
Soph :3 2026-01-16 20:48:12 +02:00
parent f47d113a01
commit 578edf32d4
3 changed files with 33 additions and 26 deletions

View file

@ -21,19 +21,19 @@
import { toast } from 'svelte-sonner';
import type { PageServerLoad } from '../../routes/app/$types';
import { overview_data } from '$lib/state.svelte';
// Props for the member sidebar.
let {
open = $bindable(true),
members = $bindable<OverviewUser[]>([]),
user,
data,
psd,
currentEntity,
currentEntityId = $bindable<string | null>(null)
}: {
open: boolean;
members: OverviewUser[];
data: OverviewData;
psd: PageServerLoad;
user: SessionValidationResult['user'];
currentEntity: OverviewGroup | OverviewServer;
@ -84,7 +84,7 @@
if (result.type == 'error' || result.type == 'failure') {
toast.error(
'Could not configure group successfully: ' +
(result.error || result.data?.error)
(result.type === 'error' ? result.error : result.data?.error)
);
}
@ -145,7 +145,7 @@
if (result.type == 'error' || result.type == 'failure') {
toast.error(
'Could not delete group successfully: ' +
(result.error || result.data?.error)
(result.type === 'error' ? result.error : result.data?.error)
);
}
@ -166,7 +166,7 @@
<Tabs.Content value="users">
<div class="space-y-6 p-2">
{#if (currentEntity as OverviewGroup).permissions.addMembers || user.id == currentEntity.ownerId}
{@const addableMembers = data.friends.filter(
{@const addableMembers = overview_data.friends.filter(
(z) => !members.find((h) => h.id == z.id)
)}
@ -184,7 +184,7 @@
if (result.type == 'error' || result.type == 'failure') {
toast.error(
'Could not add users successfully: ' +
(result.error || result.data?.error)
(result.type === 'error' ? result.error : result.data?.error)
);
}
@ -224,7 +224,7 @@
if (result.type == 'error' || result.type == 'failure') {
toast.error(
'Could not change title successfully: ' +
(result.error || result.data?.error)
(result.type === 'error' ? result.error : result.data?.error)
);
}
@ -258,7 +258,7 @@
if (result.type == 'error' || result.type == 'failure') {
toast.error(
'Could not remove users successfully: ' +
(result.error || result.data?.error)
(result.type === 'error' ? result.error : result.data?.error)
);
}