Skip to content

Commit

Permalink
fix: ♻️ Fixed issue where response was in the toast.
Browse files Browse the repository at this point in the history
Co-authored-by: Ashley Bailey <admin@ashleybailey.me>
  • Loading branch information
JamsRepos and realashleybailey committed Oct 30, 2023
1 parent 134b03e commit e89bf81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
});
Expand Down
7 changes: 5 additions & 2 deletions apps/wizarr-frontend/src/modules/settings/pages/Discord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
},
Expand Down

0 comments on commit e89bf81

Please sign in to comment.