switch to routerbased names for login&settings

This commit is contained in:
Felix Nüsse 2022-03-16 15:19:09 +01:00
parent f70f4a3700
commit 994c441a09
3 changed files with 4 additions and 23 deletions

View File

@ -12,7 +12,7 @@ import ProfileSettings from "@/views/settings/Profile";
import Shares from "@/views/settings/Shares"; import Shares from "@/views/settings/Shares";
import Errors from "@/views/Errors"; import Errors from "@/views/Errors";
import store from "@/store"; import store from "@/store";
import { baseURL } from "@/utils/constants"; import { baseURL, name as instancename } from "@/utils/constants";
Vue.use(Router); Vue.use(Router);
@ -29,7 +29,7 @@ const router = new Router({
return next({ path: "/files" }); return next({ path: "/files" });
} }
document.title = "Login"; document.title = "Login - " + instancename;
next(); next();
}, },
}, },
@ -140,7 +140,7 @@ const router = new Router({
}); });
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
document.title = to.name; document.title = to.name + " - " + instancename;
if (to.matched.some((record) => record.meta.requiresAuth)) { if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!store.getters.isLogged) { if (!store.getters.isLogged) {

View File

@ -69,7 +69,6 @@ export default {
}; };
}, },
mounted() { mounted() {
window.document.title = window.document.title + " - " + name;
if (!recaptcha) return; if (!recaptcha) return;
window.grecaptcha.ready(function () { window.grecaptcha.ready(function () {

View File

@ -50,10 +50,9 @@
</template> </template>
<script> <script>
import { mapMutations, mapState } from "vuex"; import { mapState } from "vuex";
import HeaderBar from "@/components/header/HeaderBar"; import HeaderBar from "@/components/header/HeaderBar";
import { name } from "@/utils/constants";
export default { export default {
name: "settings", name: "settings",
@ -64,22 +63,5 @@ export default {
...mapState(["user", "loading"]), ...mapState(["user", "loading"]),
name: () => name, name: () => name,
}, },
created() {
this.fetchData();
},
watch: {
$route: "fetchData",
reload: function (value) {
if (value === true) {
this.fetchData();
}
},
},
methods: {
...mapMutations(["setLoading"]),
async fetchData() {
document.title = document.title + ` - ${this.name}`;
},
},
}; };
</script> </script>