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