Rename character as a group member.

Unify CSRF headers usage in fetch request.
This commit is contained in:
SillyLossy
2023-04-30 22:36:18 +03:00
parent 3c48c2be82
commit 6615d94051
10 changed files with 114 additions and 98 deletions

View File

@@ -2,13 +2,13 @@ import {
characters,
saveChat,
sendSystemMessage,
token,
system_messages,
system_message_types,
this_chid,
openCharacterChat,
chat_metadata,
callPopup,
getRequestHeaders,
} from "../script.js";
import { selected_group } from "./group-chats.js";
@@ -25,10 +25,7 @@ const bookmarkNameToken = 'Bookmark #';
async function getExistingChatNames() {
const response = await fetch("/getallchatsofcharacter", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
"X-CSRF-Token": token,
},
headers: getRequestHeaders(),
body: JSON.stringify({ avatar_url: characters[this_chid].avatar })
});