Movie now uses the new documentTitle module to set when loading movie and when popover dismissed we set it to the previous documenTitle. Created a getter for documentTitle. This makes it easier to only get the title variable and not try save and parse the document title with all the extra prefixes

This commit is contained in:
2019-10-22 23:34:54 +02:00
parent f45dcc560c
commit 4a46bbd2be

View File

@@ -120,7 +120,7 @@ import img from '@/directives/v-image.js'
import TorrentList from './TorrentList.vue' import TorrentList from './TorrentList.vue'
import Person from './Person.vue' import Person from './Person.vue'
import SidebarListElement from './ui/sidebarListElem.vue' import SidebarListElement from './ui/sidebarListElem.vue'
import store from '@/store.js' import store from '@/store'
import LoadingPlaceholder from './ui/LoadingPlaceholder.vue' import LoadingPlaceholder from './ui/LoadingPlaceholder.vue'
import { getMovie, getShow, request, getRequestStatus } from '@/api.js' import { getMovie, getShow, request, getRequestStatus } from '@/api.js'
@@ -156,7 +156,7 @@ export default {
this.checkIfRequested(movie) this.checkIfRequested(movie)
.then(status => this.requested = status) .then(status => this.requested = status)
document.title = movie.title + storage.pageTitlePostfix store.dispatch('documentTitle/updateTitle', movie.title)
}, },
async checkIfRequested(movie) { async checkIfRequested(movie) {
return await getRequestStatus(movie.id, movie.type) return await getRequestStatus(movie.id, movie.type)
@@ -195,10 +195,10 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
document.title = this.prevDocumentTitle store.dispatch('documentTitle/updateTitle', this.prevDocumentTitle)
}, },
created(){ created(){
this.prevDocumentTitle = document.title this.prevDocumentTitle = store.getters['documentTitle/title']
if (this.type === 'movie') { if (this.type === 'movie') {
getMovie(this.id) getMovie(this.id)