2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
|
|
|
<div id="app" class="app-wrapper app-root">
|
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<router-view></router-view>
|
|
|
|
</transition>
|
2019-12-16 12:53:14 +00:00
|
|
|
<woot-snackbar-box />
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-04-06 16:47:07 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import { mapGetters } from 'vuex';
|
2019-08-14 09:48:44 +00:00
|
|
|
import WootSnackbarBox from './components/SnackbarContainer';
|
2020-04-06 16:47:07 +00:00
|
|
|
import { accountIdFromPathname } from './helper/URLHelper';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
2019-08-25 06:13:15 +00:00
|
|
|
name: 'App',
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
components: {
|
|
|
|
WootSnackbarBox,
|
|
|
|
},
|
|
|
|
|
2020-04-06 16:47:07 +00:00
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
getAccount: 'accounts/getAccount',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
mounted() {
|
2020-02-16 11:50:38 +00:00
|
|
|
this.$store.dispatch('setUser');
|
2020-11-24 13:04:31 +00:00
|
|
|
this.setLocale(window.chatwootConfig.selectedLocale);
|
2020-04-06 16:47:07 +00:00
|
|
|
this.initializeAccount();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-11-24 13:04:31 +00:00
|
|
|
setLocale(locale) {
|
|
|
|
Vue.config.lang = locale;
|
|
|
|
},
|
|
|
|
|
2020-04-06 16:47:07 +00:00
|
|
|
async initializeAccount() {
|
|
|
|
const { pathname } = window.location;
|
|
|
|
const accountId = accountIdFromPathname(pathname);
|
|
|
|
|
|
|
|
if (accountId) {
|
|
|
|
await this.$store.dispatch('accounts/get');
|
|
|
|
const { locale } = this.getAccount(accountId);
|
2020-11-24 13:04:31 +00:00
|
|
|
this.setLocale(locale);
|
2020-04-06 16:47:07 +00:00
|
|
|
}
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import './assets/scss/app';
|
|
|
|
</style>
|
2019-08-25 06:13:15 +00:00
|
|
|
|
|
|
|
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
|