ciscoheat/sveltekit-flash-message

Suggestion: improve `getFlash` options

Ennoriel opened this issue · 1 comments

I am using this library with sveltekit-superforms and without svelte-french-toast.

I'd like to be able to say from the server of my app if the notification is a success, a warning or an error. In case of a success and warning, I'd like the toast to disappear after 6 and 8 seconds while I don't want the errors to disappear by themselves.

In other words, I'd like to configure options based on the flash message.

This could me achieved with options being a configuration object or a function with the following signature (flash: App.PageData['flash']): Partial<FlashOptions>.

The options are a bit complicated, being tied to specific routes and below, so I'm afraid I cannot do that easily. I think you can handle this case with a reactive statement though, doing a setTimeout that sets the store to undefined depending on status..