Confirm character duplication

This commit is contained in:
Cohee 2023-07-22 21:50:21 +03:00
parent d3fe20c119
commit e38a9df538
1 changed files with 8 additions and 11 deletions

View File

@ -3151,6 +3151,13 @@ async function DupeChar() {
return;
}
const confirm = await callPopup('Are you sure you want to duplicate this character?', 'confirm');
if (!confirm) {
console.log('User cancelled duplication');
return;
}
const body = { avatar_url: characters[this_chid].avatar };
const response = await fetch('/dupecharacter', {
method: 'POST',
@ -8240,17 +8247,7 @@ $(document).ready(function () {
});
$("#dupe_button").click(async function () {
const body = { avatar_url: characters[this_chid].avatar };
const response = await fetch('/dupecharacter', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify(body),
});
if (response.ok) {
toastr.success("Character Duplicated");
getCharacters();
}
await DupeChar();
});
$(document).on("click", ".select_chat_block, .bookmark_link, .mes_bookmark", async function () {