refactor(notification): use SvelteKit form actions instead of raw fetch #630

Closed
marcel wants to merge 11 commits from feat/issue-286-notification-bell-form-actions into main
Showing only changes of commit 2adb98895d - Show all commits

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 } }