frontend/src/App.vue

77 lines
2.1 KiB
Vue

<template>
<div id="app">
<Navbar />
<main>
<router-view />
</main>
<Footer />
</div>
</template>
<script>
import Navbar from "./components/Navbar";
import Footer from "./components/Footer";
import axios from "axios";
export default {
name: "KavertiApp",
components: {
Navbar,
Footer,
},
mounted() {
if (JSON.parse(localStorage.getItem("token"))) {
this.$store.commit("setToken", JSON.parse(localStorage.getItem("token")));
}
if (JSON.parse(localStorage.getItem("wind404"))) {
var wind = JSON.parse(localStorage.getItem("wind404"));
}
this.$store.commit("setWind", wind);
Object.assign(axios.defaults, {
headers: { Authorization: this.$store.state.user.token },
});
if (this.$store.state.debug) {
this.$buefy.snackbar.open({
message: this.$t("errors.devBuild"),
type: "is-warning",
});
}
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);
})
if (this.$store.state.user.username) {
this.axios.get(
process.env.VUE_APP_API_ENDPOINT +
process.env.VUE_APP_API_VERSION +
"/" +
"awards/eligibility"
)
}
},
};
</script>
<style lang="scss">
@import "./assets/scss/buefy";
@import "./assets/scss/editor";
</style>
<style lang="css">
@import "./assets/css/kaverti.css";
@import "https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css";
</style>