Files
windmill/frontend/src/lib/toast.ts
T
Ruben Fiszel 36280cffc8 feat: expose a react sdk to integrate windmill into react apps (#1605)
* expose react sdk

* expose react sdk

* iterate

* iterate

* iterate

* nit

* update example

* update example

* small fixes

* update all
2023-05-19 20:44:07 +02:00

34 lines
580 B
TypeScript

import Toast from '$lib/components/Toast.svelte'
import { toast } from '@zerodevx/svelte-toast'
export type ToastAction = {
label: string
callback: () => void
}
export function sendUserToast(
message: string,
error: boolean = false,
actions: ToastAction[] = [],
errorMessage: string | undefined = undefined
): void {
toast.push({
component: {
src: Toast,
props: {
message,
error,
actions,
errorMessage
},
sendIdTo: 'toastId'
},
dismissable: false,
initial: 0,
theme: {
'--toastPadding': '0',
'--toastMsgPadding': '0'
}
})
}