Implement dummy Budget-Settings and extract setTitle mutation

This commit is contained in:
Jan Bader 2022-01-25 20:40:00 +00:00
parent 74c4c7cb02
commit ffed94f586
5 changed files with 9 additions and 13 deletions

View File

@ -1,9 +1,6 @@
<script>
// This starter template is using Vue 3 <script setup> SFCs
import { LOGOUT } from "./store/mutation-types";
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
export default {
data() {
return {

View File

@ -1,12 +1,7 @@
<script>
import { LOGIN_SUCCESS } from "../store/mutation-types";
import { LOGIN_SUCCESS, TITLE } from "../store/mutation-types";
export default {
computed: {
dashboard () {
return this.$store.state;
}
},
data() {
return {
error: [],
@ -18,7 +13,7 @@ export default {
}
},
mounted () {
this.$store.commit("setTitle", "Login");
this.$store.commit(TITLE, "Login");
},
methods: {
formSubmit (e) {

View File

@ -4,6 +4,7 @@ import Dashboard from '../pages/Dashboard.vue';
import Login from '../pages/Login.vue';
import Register from '../pages/Register.vue';
import Account from '../pages/Account.vue';
import Settings from '../pages/Settings.vue';
const routes = [
{ path: '/', name: 'Index', component: Dashboard },
@ -11,6 +12,7 @@ const routes = [
{ path: '/login', name: 'Login', component: Login },
{ path: '/register', name: 'Register', component: Register },
{ path: '/budget/:budgetid', name: 'Budget', components: { default: Dashboard, sidebar: BudgetSidebar }, props: true },
{ path: '/budget/:budgetid/Settings', name: 'Budget Settings', components: { default: Settings, sidebar: BudgetSidebar }, props: true },
{ path: '/budget/:budgetid/account/:accountid', name: 'Account', components: { default: Account, sidebar: BudgetSidebar }, props: true },
]

View File

@ -1,3 +1,5 @@
import { TITLE } from "../mutation-types";
const budget = {
state () {
return {
@ -62,7 +64,7 @@ const budget = {
continue
commit("setCurrentAccount", element);
commit("setTitle", element.Name);
commit(TITLE, element.Name);
break
}
}

View File

@ -1,7 +1,7 @@
import { createStore } from 'vuex'
import dashboard from './dashboard/index'
import budget from './budget/index'
import { LOGIN_SUCCESS, LOGOUT } from './mutation-types'
import { LOGIN_SUCCESS, LOGOUT, TITLE } from './mutation-types'
const store = createStore({
state () {
@ -21,7 +21,7 @@ const store = createStore({
);
}
},
setTitle (state, title) {
[TITLE](state, title) {
document.title = "Budgeteer - " + title;
},
[LOGIN_SUCCESS](state, session) {