frontend/src/App.vue

85 lines
2.2 KiB
Vue

<template>
<div id="app">
<Navbar />
<main>
<router-view />
</main>
<Footer />
</div>
</template>
<style>
@import './assets/css/kaverti.css';
</style>
<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"));
} else {
// eslint-disable-next-line no-redeclare
var wind = false;
}
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_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"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);
})
.catch(() => {
this.$buefy.snackbar.open({
message: this.$t("errors.down"),
type: "is-warning",
});
});
this.axios.get(
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"awards/eligibility"
);
},
};
</script>
<style lang="scss">
@import "./assets/scss/buefy";
@import "./assets/scss/editor";
</style>
<style lang="css">
@import "https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css";
</style>