completionId: cgen-7c53e2d3b852481b8aa6ac25bce4b268
cgen-7c53e2d3b852481b8aa6ac25bce4b268
This commit is contained in:
parent
1642b066c1
commit
0fbac0515c
1 changed files with 4 additions and 3 deletions
|
|
@ -172,12 +172,13 @@ export function AdminDiscordManagement() {
|
|||
},
|
||||
});
|
||||
|
||||
// Read body only once
|
||||
const data = await response.json().catch(() => ({}));
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
throw new Error(errorData.error || "Failed to register commands");
|
||||
throw new Error(data?.error || "Failed to register commands");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
setRegisterSuccess(
|
||||
data.message || "Discord commands registered successfully!",
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue