Improve document.title handling

This commit is contained in:
Ken-Håvard Lieng 2018-11-22 10:09:13 +01:00
parent 09a1933131
commit bd0541120f
2 changed files with 52 additions and 48 deletions

File diff suppressed because one or more lines are too long

View File

@ -8,16 +8,20 @@ export default function documentTitle({ store }) {
let title; let title;
if (router.route === 'chat') { if (router.route === 'chat') {
const { name } = router.params; const { server, name } = router.params;
if (name) { if (name) {
title = `${name} @ ${serverName}`; title = `${name} @ ${serverName || server}`;
} else { } else {
title = serverName; title = serverName || server;
} }
} else { } else {
title = capitalize(router.route); title = capitalize(router.route);
} }
document.title = `${title} | Dispatch`; if (title) {
document.title = `${title} | Dispatch`;
} else {
document.title = 'Dispatch';
}
}); });
} }