feat: add buy confirm
This commit is contained in:
@@ -88,6 +88,11 @@ const updateMediaSource = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleBuy = async () => {
|
const handleBuy = async () => {
|
||||||
|
// confirm
|
||||||
|
if (!confirm("确认购买该曲谱?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (buying.value) return;
|
if (buying.value) return;
|
||||||
buying.value = true;
|
buying.value = true;
|
||||||
try {
|
try {
|
||||||
@@ -123,9 +128,12 @@ const handleBuy = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
return
|
||||||
alert("余额支付成功");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alert("余额支付成功");
|
||||||
|
fetchArticle();
|
||||||
|
await updateMediaSource();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to initiate payment:", error);
|
console.error("Failed to initiate payment:", error);
|
||||||
alert("发起支付失败,请稍后重试");
|
alert("发起支付失败,请稍后重试");
|
||||||
|
|||||||
Reference in New Issue
Block a user