From e89bf81640de3aa5729e02c8dec0865f3b216cca Mon Sep 17 00:00:00 2001 From: Jam <1347620+JamsRepos@users.noreply.github.com> Date: Mon, 30 Oct 2023 02:22:54 +0000 Subject: [PATCH] fix: :recycle: Fixed issue where response was in the toast. Co-authored-by: Ashley Bailey --- .../src/modules/help/components/Discord.vue | 2 +- .../wizarr-frontend/src/modules/settings/pages/Discord.vue | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/wizarr-frontend/src/modules/help/components/Discord.vue b/apps/wizarr-frontend/src/modules/help/components/Discord.vue index 6e37da346..5e65a4dbb 100644 --- a/apps/wizarr-frontend/src/modules/help/components/Discord.vue +++ b/apps/wizarr-frontend/src/modules/help/components/Discord.vue @@ -73,7 +73,7 @@ export default defineComponent({ methods: { async loadWidgetAPI(guild: string) { // Load the Discord Widget API - const response = await this.$axios.get(`https://discord.com/api/guilds/${guild}/widget.json`).catch(() => { + const response = await this.$rawAxios.get(`https://discord.com/api/guilds/${guild}/widget.json`).catch(() => { this.$toast.info("Unable to load Discord Widget, this is most likely due to too many requests."); }); diff --git a/apps/wizarr-frontend/src/modules/settings/pages/Discord.vue b/apps/wizarr-frontend/src/modules/settings/pages/Discord.vue index c98145f9f..e080bf61c 100644 --- a/apps/wizarr-frontend/src/modules/settings/pages/Discord.vue +++ b/apps/wizarr-frontend/src/modules/settings/pages/Discord.vue @@ -60,15 +60,18 @@ export default defineComponent({ const formData = new FormData(); formData.append("server_discord_id", this.serverId); - const validate = await this.$axios.get(`https://discord.com/api/guilds/${this.serverId}/widget.json`).catch((validation) => { + 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 (!validate) return; + const response = await this.$axios.put("/api/settings", formData).catch(() => { this.$toast.error(this.__("Unable to save connection.")); }); - if (!response?.data || !validate?.data) return; + if (!response?.data) return; this.$toast.info("Discord Server ID saved successfully."); },