Closed engageintellect closed 1 year ago
I solved this by redirecting back to the edit page:
deleteThumbnail: async ({ locals, params }) => {
try {
await locals.pb.collection('projects').update(params.projectId, { thumbnail: null });
} catch (err) {
console.log('** ERROR:', err);
throw error(err.status, err.message);
}
throw redirect(303, `/projects/${params.projectId}/edit`);
}
I solved this by redirecting back to the edit page:
deleteThumbnail: async ({ locals, params }) => { try { await locals.pb.collection('projects').update(params.projectId, { thumbnail: null }); } catch (err) { console.log('** ERROR:', err); throw error(err.status, err.message); } throw redirect(303, `/projects/${params.projectId}/edit`); }
Exactly what I needed. Thank you! And, happy 4th.
The proper solution comes later https://youtu.be/Ct3TSEJeD8I?list=PLq30BP0TIcqW3sMm404UIEA7osPEkKAyg&t=2453
Using the thumbnail delete button appears to clear the form. See below for example.
Before:
After - Clicking red trash button clears the whole form, yet yields the expected result in PocketBase (remove thumbnail):
I copied your files for $lib/components/MyProjectItem.svelte as well as everything under /routes/projects just to make sure I didn't mistype anything, the result appears to be the same.
I have made a branch in my own repository to isolate/highlight this issue: https://github.com/engageintellect/sveltekit-pocket/tree/delete-thumbnail-issue
Hopefully someone can point out what I may be missing?