dev: avoid getting event from alertDialog
Massimo Melina committed
Jan 24, 2024 at 19:20 UTC
485e770580cb12856ca72815a81ff0a3fe3c5835
2 files changed
+3
-2
admin/src/VfsTree.ts
+2
-1
@@ -134,8 +134,9 @@ export default function VfsTkree({ id2node, statusApi, onSelect }:{ id2node: Map
134
}
135
136
export function moveVfs(from: string, to: string) {
137
- apiCall('move_vfs', { from, parent: to }).then(() => {
137
+ return apiCall('move_vfs', { from, parent: to }).then(() => {
138
reloadVfs([ to + from.slice(1 + from.lastIndexOf('/', from.length-2)) ])
139
+ return true
140
}, alertDialog)
141
}
142
admin/src/dialog.ts
+1
-1
@@ -98,7 +98,7 @@ export function alertDialog(msg: ReactElement | string | Error, options?: AlertT
98
return h(Box, { display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1 },
99
isValidElement(msg) ? msg
100
: h(Box, { fontSize: 'large', lineHeight: '1.8em' }, String(msg)),
101
- h(Btn, { sx: { mt: 1 }, size: 'small', onClick: dialog.close }, "Close")
101
+ h(Btn, { sx: { mt: 1 }, size: 'small', onClick: () => dialog.close() }, "Close")
102
)
103
}
104
})