Skip to content

Commit

Permalink
fix(frontend): cant remove discord widget id (#347)
Browse files Browse the repository at this point in the history
* fix(frontend): 馃殤 user can now remove discord widget id

* console.log removed, no longer needed
  • Loading branch information
PhantomMantis committed Apr 7, 2024
1 parent 05ce4f5 commit fefcb06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/wizarr-frontend/src/modules/settings/pages/Discord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@ export default defineComponent({
const validate = await this.$rawAxios.get(`https://discord.com/api/guilds/${this.serverId}/widget.json`).catch((validation) => {
// Discord Docs: https://discord.com/developers/docs/topics/opcodes-and-status-codes
if (validation.response.data.code === 50004) this.$toast.error(this.__("Unable to save due to widgets being disabled on this server."));
if (validation.response.data.code === 50004) {
this.$toast.error(this.__("Unable to save due to widgets being disabled on this server."));
} else if (this.serverId === "") {
return Promise.resolve(true); // No server ID, so we can save it
} else {
this.$toast.error(this.__("Unable to save due to an invalid server ID."));
}
});
if (!validate) return;
const response = await this.$axios.put("/api/settings", formData).catch(() => {
this.$toast.error(this.__("Unable to save connection."));
return;
});
if (!response?.data) return;
Expand Down

0 comments on commit fefcb06

Please sign in to comment.