mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-04 12:36:37 +08:00
refactor: split modules and harden scraping workflows
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { createRoot } from 'react-dom/client'
|
||||
|
||||
import { ConfirmDialog, type ConfirmOptions } from './ConfirmDialog'
|
||||
|
||||
export function confirmAction(options: ConfirmOptions): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
const root = createRoot(host)
|
||||
const close = (value: boolean) => {
|
||||
root.unmount()
|
||||
host.remove()
|
||||
resolve(value)
|
||||
}
|
||||
root.render(<ConfirmDialog options={options} onClose={close} />)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user