|
|
@@ -69,18 +69,16 @@ nav a:first-of-type {
|
|
|
import { useFooterLinksStore } from '@/stores/footer-content-pages'
|
|
|
import { useTimelineStore } from '@/stores/timeline'
|
|
|
import { useComponentStore } from '@/stores/component'
|
|
|
+ import { usePageStore } from '@/stores/pages'
|
|
|
import {loadDynamicPages} from '@/router'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
|
export default {
|
|
|
- name: 'Navigation',
|
|
|
data () {
|
|
|
return {
|
|
|
links: [] as Array<any>,
|
|
|
error: null as any,
|
|
|
- footerLinksStroe: null as any,
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
setup(){
|
|
|
@@ -88,38 +86,31 @@ nav a:first-of-type {
|
|
|
inheritLocale: true
|
|
|
})
|
|
|
const route = useRoute()
|
|
|
-
|
|
|
+ const footerLinksStroe = useFooterLinksStore()
|
|
|
return{
|
|
|
t,
|
|
|
- route
|
|
|
+ route,
|
|
|
+ footerLinksStroe
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
- if(!this.footerLinksStroe){
|
|
|
- this.footerLinksStroe = useFooterLinksStore()
|
|
|
- }
|
|
|
-
|
|
|
this.links = await this.footerLinksStroe.getLinks(this.$i18n.locale)
|
|
|
},
|
|
|
methods:{
|
|
|
async changeLocale(){
|
|
|
const locale = this.$i18n.locale
|
|
|
- loadDynamicPages(locale)
|
|
|
localStorage.setItem('lang', locale)
|
|
|
- if(!this.footerLinksStroe){
|
|
|
- this.footerLinksStroe = useFooterLinksStore()
|
|
|
- }
|
|
|
- useTimelineStore().setLocale(locale)
|
|
|
- useComponentStore().setLocale(locale)
|
|
|
+ const pageStore = usePageStore()
|
|
|
+ await pageStore.setLocale(locale)
|
|
|
+ await useTimelineStore().setLocale(locale)
|
|
|
+ await useComponentStore().setLocale(locale)
|
|
|
+ loadDynamicPages(pageStore.pages)
|
|
|
const oldLink = this.footerLinksStroe.getLinkByLabel(this.route.name)
|
|
|
this.links = await this.footerLinksStroe.getLinks(locale)
|
|
|
- const newLink = this.footerLinksStroe.getLinkByLabel(oldLink.localizations[0].Label)
|
|
|
- if(newLink){
|
|
|
+ if(oldLink){
|
|
|
+ const newLink = this.footerLinksStroe.getLinkByLabel(oldLink.localizations[0].Label)
|
|
|
setTimeout(() => {this.$router.push(newLink.page.path)}, 100)
|
|
|
- }else{
|
|
|
- setTimeout(() => {this.$router.push("/")}, 100)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|