chore(history): import initial web product snapshot
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
export interface ConfirmOptions {
|
||||
title: string
|
||||
description?: string
|
||||
confirmText?: string
|
||||
cancelText?: string
|
||||
danger?: boolean
|
||||
onConfirm: () => void | Promise<void>
|
||||
}
|
||||
|
||||
interface ConfirmState {
|
||||
current: ConfirmOptions | null
|
||||
ask: (opts: ConfirmOptions) => void
|
||||
close: () => void
|
||||
}
|
||||
|
||||
export const useConfirmStore = create<ConfirmState>()((set) => ({
|
||||
current: null,
|
||||
ask: (opts) => set({ current: opts }),
|
||||
close: () => set({ current: null }),
|
||||
}))
|
||||
|
||||
/** 任意位置调用:confirmDialog({ title, danger, onConfirm }) */
|
||||
export function confirmDialog(opts: ConfirmOptions): void {
|
||||
useConfirmStore.getState().ask(opts)
|
||||
}
|
||||
Reference in New Issue
Block a user