Add confirmation popup util
This commit is contained in:
@@ -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
17
src/lib/util/modals.ts
Normal 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
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user