fix(comments): convert confirm_with_message Result to Option for WASM compatibility

This commit is contained in:
xfy 2026-06-11 13:15:17 +08:00
parent 04737300e6
commit c10134c32e

View File

@ -106,7 +106,7 @@ pub fn AdminCommentsPage(page: i32) -> Element {
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {
if web_sys::window() if web_sys::window()
.and_then(|w| w.confirm_with_message("确定要删除这些评论吗?")) .and_then(|w| w.confirm_with_message("确定要删除这些评论吗?").ok())
.unwrap_or(false) .unwrap_or(false)
{ {
let ids: Vec<i64> = selected_ids().iter().copied().collect(); let ids: Vec<i64> = selected_ids().iter().copied().collect();
@ -211,7 +211,7 @@ pub fn AdminCommentsPage(page: i32) -> Element {
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {
if web_sys::window() if web_sys::window()
.and_then(|w| w.confirm_with_message("确定要删除这条评论吗?")) .and_then(|w| w.confirm_with_message("确定要删除这条评论吗?").ok())
.unwrap_or(false) .unwrap_or(false)
{ {
let id = id; let id = id;