diff --git a/web/src/App.vue b/web/src/App.vue
index 61d3df4..015a538 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -1,11 +1,26 @@
-
- Go to Bar
+
+ - Login
+ - Logout
+ - Dashboard
+
+
diff --git a/web/src/main.js b/web/src/main.js
index ed4e490..2a59912 100644
--- a/web/src/main.js
+++ b/web/src/main.js
@@ -6,20 +6,45 @@ import router from './router/index.js'
const store = createStore({
state () {
return {
+ Session: {
+ Token: null,
+ User: null
+ },
Budgets: [],
CurrentBudget: null,
}
},
mutations: {
+ initializeStore(state) {
+ if(localStorage.getItem("store")){
+ this.replaceState(
+ Object.assign(state, JSON.parse(localStorage.getItem("store")))
+ );
+ }
+ },
getDashboard (state) {
- fetch("/api/v1/dashboard")
+ fetch("/api/v1/dashboard", {
+ headers: {
+ 'Authorization': 'Bearer ' + state.Token
+ }
+ })
.then(x => x.json())
- .then(x => console.log(x))
- .then(x => state.Budgets = x.Budgets);
+ .then(x => state.Budgets = x.Budgets)
+ .then(x => console.log(state.Budgets));
+ },
+ setTitle (state, title) {
+ document.title = "Budgeteer - " + title;
+ },
+ setToken(state, token) {
+ state.Token = token;
}
}
})
+store.subscribe((mutation, state) => {
+ localStorage.setItem("store", JSON.stringify(state));
+})
+
const app = createApp(App)
app.use(router)
app.use(store)
diff --git a/web/src/router/index.js b/web/src/router/index.js
index 363c213..095e9f3 100644
--- a/web/src/router/index.js
+++ b/web/src/router/index.js
@@ -1,9 +1,11 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import HelloWorld from '../components/HelloWorld.vue';
import Dashboard from '../pages/Dashboard.vue';
+import Login from '../pages/Login.vue';
const routes = [
{ path: '/', name: 'Index', component: Dashboard },
+ { path: '/login', name: 'Login', component: Login },
{ path: '/uiae', name: 'Home', component: HelloWorld },
]