Fix random error on init

This commit is contained in:
Troplo 2021-04-10 18:25:52 +10:00
parent 40f5898cd0
commit 93142a1ab2
2 changed files with 43 additions and 51 deletions

View file

@ -642,13 +642,6 @@ export default {
this.settings.general.description.value = res.data.description; this.settings.general.description.value = res.data.description;
this.loading = false; this.loading = false;
}) })
.catch(() => {
this.$buefy.snackbar.open({
message: this.$t("errors.authFail"),
type: "is-warning",
});
this.loading = false;
});
}, },
}, },
mounted() { mounted() {
@ -673,34 +666,32 @@ export default {
type: "is-info", type: "is-info",
}); });
}); });
this.axios this.$nextTick(() => {
.get( this.axios
process.env.VUE_APP_API_ENDPOINT + .get(
process.env.VUE_APP_API_VERSION + process.env.VUE_APP_API_ENDPOINT +
"/" + process.env.VUE_APP_API_VERSION +
"userinfo" "/" +
) "userinfo"
.then((res) => { )
this.$store.commit("setUsername", res.data.username); .then((res) => {
this.$store.commit("setEmail", res.data.email); this.$store.commit("setUsername", res.data.username);
this.$store.commit("setEmailVerified", res.data.emailVerified); this.$store.commit("setEmail", res.data.email);
this.$store.commit("setAdmin", res.data.admin); this.$store.commit("setEmailVerified", res.data.emailVerified);
this.$store.commit("setKoins", res.data.koins); this.$store.commit("setAdmin", res.data.admin);
this.$store.commit("setID", res.data.id); this.$store.commit("setKoins", res.data.koins);
this.$store.commit("setBot", res.data.bot); this.$store.commit("setID", res.data.id);
this.$store.commit("setDescription", res.data.description); this.$store.commit("setBot", res.data.bot);
this.$store.commit("setExecutive", res.data.executive); this.$store.commit("setDescription", res.data.description);
this.settings.general.description.value = res.data.description; this.$store.commit("setExecutive", res.data.executive);
this.loading = false; this.settings.general.description.value = res.data.description;
}) this.loading = false;
.catch(() => { })
this.$buefy.snackbar.open({ .catch(() => {
message: this.$t("errors.authFail"), this.loading = false;
type: "is-warning", console.log(this.getBannerId());
}); });
this.loading = false; })
console.log(this.getBannerId());
});
this.$nextTick(() => { this.$nextTick(() => {
this.dailyReward(false); this.dailyReward(false);
this.showUpdate(); this.showUpdate();

View file

@ -188,24 +188,25 @@ export default {
} }
}); });
}, },
getBlog() {
this.axios
.get(
process.env.VUE_APP_API_ENDPOINT +
process.env.VUE_APP_API_VERSION +
`/` +
`blog/posts`
)
.then((res) => {
this.blogs = res.data;
})
.catch((e) => {
AjaxErrorHandler(this.$store)(e);
});
}
}, },
mounted() { mounted() {
if (this.$store.state.user.username) { this.getBlog()
this.axios this.getWall(true);
.get(
process.env.VUE_APP_API_ENDPOINT +
process.env.VUE_APP_API_VERSION +
`/` +
`blog/posts`
)
.then((res) => {
this.blogs = res.data;
})
.catch((e) => {
AjaxErrorHandler(this.$store)(e);
});
this.getWall(true);
}
}, },
}; };
</script> </script>