Add confirmation popup util

This commit is contained in:
ZXY101
2023-09-14 12:19:25 +02:00
parent 2fd4ebd101
commit ed6b8d8b39
8 changed files with 63 additions and 68 deletions

View File

@@ -1,3 +1,4 @@
export * from './snackbar'
export * from './upload'
export * from './misc'
export * from './misc'
export * from './modals'

17
src/lib/util/modals.ts Normal file
View File

@@ -0,0 +1,17 @@
import { writable } from "svelte/store";
type ConfirmationPopup = {
open: boolean;
message: string;
onConfirm?: () => void;
};
export const confirmationPopupStore = writable<ConfirmationPopup | undefined>(undefined);
export function promptConfirmation(message: string, onConfirm?: () => void) {
confirmationPopupStore.set({
open: true,
message,
onConfirm
});
}