fix(aktivitaeten): narrow File cast and use null payload for missing notificationId

Replace 'as string | null' cast (which silently accepts File values) with an explicit
typeof check. Use error: null instead of hardcoded German so the client falls through
to the generic i18n-keyed error banner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-20 07:06:15 +02:00
parent 6049dcadd3
commit 2adb98895d

View File

@@ -71,8 +71,9 @@ export async function load({ fetch, url }) {
export const actions = {
'dismiss-notification': async ({ request, fetch }) => {
const data = await request.formData();
const notificationId = data.get('notificationId') as string | null;
if (!notificationId) return fail(400, { error: 'Ungültige Benachrichtigungs-ID' });
const raw = data.get('notificationId');
const notificationId = typeof raw === 'string' ? raw : null;
if (!notificationId) return fail(400, { error: null });
const api = createApiClient(fetch);
const result = await api.PATCH('/api/notifications/{id}/read', {
params: { path: { id: notificationId } }