KasperskyLab-TinyCheck/app/frontend/src/App.vue

67 lines
1.5 KiB
Vue
Raw Normal View History

2020-11-24 19:45:03 +01:00
<template>
<div id="app">
<div class="wrapper">
<Controls />
<transition name="fade" mode="out-in">
<router-view />
</transition>
</div>
2020-11-24 19:45:03 +01:00
</div>
</template>
<style>
@import './assets/spectre.min.css';
@import './assets/custom.css';
/* Face style for router stuff. */
.fade-enter-active,
.fade-leave-active {
transition-duration: 0.3s;
transition-property: opacity;
transition-timing-function: ease;
}
.fade-enter,
.fade-leave-active {
opacity: 0
}
</style>
<script>
2021-02-04 11:11:43 +01:00
import axios from 'axios'
import Controls from "@/components/Controls.vue"
2021-02-04 11:11:43 +01:00
2021-02-08 16:34:32 +01:00
document.title = 'TinyCheck Frontend'
export default {
name: 'app',
components: {
Controls
2021-02-04 11:11:43 +01:00
},
methods: {
2021-02-08 16:34:32 +01:00
set_lang: function() {
if (window.config.user_lang) {
var lang = window.config.user_lang
if (Object.keys(this.$i18n.messages).includes(lang)) {
this.$i18n.locale = lang
document.querySelector('html').setAttribute('lang', lang)
}
}
},
get_config: function() {
axios.get('/api/misc/config', { timeout: 60000 })
.then(response => {
this.set_lang();
window.config = response.data
})
.catch(error => { console.log(error) });
2021-02-04 11:11:43 +01:00
}
},
created: function() {
2021-02-08 16:34:32 +01:00
window.config = {}
this.get_config();
}
}
2020-11-24 19:45:03 +01:00
</script>