Updte page title

This commit is contained in:
Roman Cervantes 2018-11-04 19:27:14 -07:00
parent d35ce02eb7
commit 4a26dc0802
4 changed files with 20 additions and 1 deletions

View file

@ -44,6 +44,10 @@ router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.getters.auth) {
next('/');
} else {
if (to.meta && to.meta.title) {
document.title = `${to.meta.title} - Gamebrary`;
}
next();
}
});

View file

@ -86,6 +86,8 @@ export default {
mounted() {
this.loadGameData();
document.title = `${this.platform.name} - Gamebrary`;
},
methods: {

View file

@ -60,11 +60,12 @@ export default {
},
computed: {
...mapState(['game', 'settings']),
...mapState(['game', 'settings', 'platform']),
},
mounted() {
this.$store.commit('SET_ACTIVE_GAME', this.$route.params.id);
document.title = `${this.platform.name} - ${this.game.name} - Gamebrary`;
},
destroyed() {

View file

@ -15,6 +15,9 @@ export default new Router({
path: '/share/:id',
name: 'share',
component: ShareList,
meta: {
title: 'Public list',
},
},
{
name: 'game-detail',
@ -25,16 +28,25 @@ export default new Router({
name: 'platforms',
path: '/platforms',
component: Platforms,
meta: {
title: 'Platforms',
},
},
{
name: 'settings',
path: '/settings',
component: Settings,
meta: {
title: 'Settings',
},
},
{
path: '/session-expired',
name: 'sessionExpired',
component: SessionExpired,
meta: {
title: 'Session expired',
},
},
{
path: '/',