diff --git a/src/App.vue b/src/App.vue index 8527399811eb89cb11a8a064e7b92592742a7f29..9faff227c4884458e116b70b0f0f9dea861fd4d9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -63,17 +63,6 @@ axios.interceptors.request.use(function (config) { return Promise.reject(error); }); -window.onpopstate = function (event) { - if (event.state) { - // eslint-disable-next-line - app.__vue__._data.article = event.state.article - // eslint-disable-next-line - app.__vue__._data.search_results = event.state.search_results - // eslint-disable-next-line - app.__vue__._data.lang = event.state.lang - } -} - function navigate_to_article(self, source) { axios.get(api_endpoint + '/' + self.$route.params.lang + '/article/' + self.$route.params.id) .then(function(response){ @@ -275,6 +264,18 @@ export default { $route() { this.$plausible.trackEvent('language', {props: {code: this.$route.params.lang}}) } + }, + created: function() { + let self = this + window.onpopstate = function (event) { + if (event.state) { + console.log(event.state) + self.article = event.state.article + self.search_results = event.state.search_results + self.lang = event.state.lang + } + } + } } </script>