mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 08:30:58 -05:00
parent
3b7c1cbe20
commit
95ebd935ed
3 changed files with 4 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/setup_assets.js --check && vite",
|
"dev": "node scripts/setup_assets.js --check && vite",
|
||||||
"pull": "node scripts/setup_assets.js",
|
"pull": "node scripts/setup_assets.js",
|
||||||
|
|
|
@ -29,6 +29,7 @@ export function CreateBotModal({ onClose, onCreate }: Props) {
|
||||||
try {
|
try {
|
||||||
const { bot } = await client.bots.create({ name });
|
const { bot } = await client.bots.create({ name });
|
||||||
onCreate(bot);
|
onCreate(bot);
|
||||||
|
onClose();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(takeError(err));
|
setError(takeError(err));
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,12 +99,6 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
||||||
client.api
|
client.api
|
||||||
.get(`/users/${bot._id as ""}/profile`, undefined, {
|
.get(`/users/${bot._id as ""}/profile`, undefined, {
|
||||||
headers: { "x-bot-token": bot.token },
|
headers: { "x-bot-token": bot.token },
|
||||||
transformRequest: (data, headers) => {
|
|
||||||
// Remove user headers for this request
|
|
||||||
delete headers?.["x-user-id"];
|
|
||||||
delete headers?.["x-session-token"];
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then((profile) => setProfile(profile ?? {}));
|
.then((profile) => setProfile(profile ?? {}));
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
@ -130,7 +124,8 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
||||||
setSaving(true);
|
setSaving(true);
|
||||||
setError("");
|
setError("");
|
||||||
try {
|
try {
|
||||||
await client.bots.edit(bot._id, changes);
|
if (Object.keys(changes).length > 0)
|
||||||
|
await client.bots.edit(bot._id, changes);
|
||||||
if (changed) await editBotContent(profile?.content ?? undefined);
|
if (changed) await editBotContent(profile?.content ?? undefined);
|
||||||
onUpdate(changes);
|
onUpdate(changes);
|
||||||
setChanged(false);
|
setChanged(false);
|
||||||
|
@ -159,12 +154,6 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
||||||
avatar ? { avatar } : { remove: ["Avatar"] },
|
avatar ? { avatar } : { remove: ["Avatar"] },
|
||||||
{
|
{
|
||||||
headers: { "x-bot-token": bot.token },
|
headers: { "x-bot-token": bot.token },
|
||||||
transformRequest: (data, headers) => {
|
|
||||||
// Remove user headers for this request
|
|
||||||
delete headers?.["x-user-id"];
|
|
||||||
delete headers?.["x-session-token"];
|
|
||||||
return JSON.stringify(data);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -184,12 +173,6 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
||||||
: { remove: ["ProfileBackground"] },
|
: { remove: ["ProfileBackground"] },
|
||||||
{
|
{
|
||||||
headers: { "x-bot-token": bot.token },
|
headers: { "x-bot-token": bot.token },
|
||||||
transformRequest: (data, headers) => {
|
|
||||||
// Remove user headers for this request
|
|
||||||
delete headers?.["x-user-id"];
|
|
||||||
delete headers?.["x-session-token"];
|
|
||||||
return JSON.stringify(data);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -206,12 +189,6 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
||||||
content ? { profile: { content } } : { remove: ["ProfileContent"] },
|
content ? { profile: { content } } : { remove: ["ProfileContent"] },
|
||||||
{
|
{
|
||||||
headers: { "x-bot-token": bot.token },
|
headers: { "x-bot-token": bot.token },
|
||||||
transformRequest: (data, headers) => {
|
|
||||||
// Remove user headers for this request
|
|
||||||
delete headers?.["x-user-id"];
|
|
||||||
delete headers?.["x-session-token"];
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue