diff --git a/app/ayanova/src/App.vue b/app/ayanova/src/App.vue index dedfdafb..be423204 100644 --- a/app/ayanova/src/App.vue +++ b/app/ayanova/src/App.vue @@ -174,6 +174,17 @@ About + + + fa-sign-out-alt + + + Log off + + + + + @@ -217,9 +228,23 @@ export default { name: "App", data() { return { - drawer: null + drawer: null, + }; }, + mounted() { + if (!this.$store.state.authenticated) { + this.$router.replace({ name: "login" }); + } + }, + methods: { + setAuthenticated(status) { + this.$store.state.authenticated = status; + }, + logout() { + this.$store.state.authenticated = false; + } + }, props: { source: String } diff --git a/app/ayanova/src/router.js b/app/ayanova/src/router.js index 7b4bb791..13c9a999 100644 --- a/app/ayanova/src/router.js +++ b/app/ayanova/src/router.js @@ -10,9 +10,28 @@ export default new Router({ routes: [ { path: "/", - name: "home", - component: Home + redirect: { + name: "login" + } }, + { + path: "/login", + name: "login", + component: () => + import(/* webpackChunkName: "login" */ "./views/login.vue") + }, + { + path: "/secure", + name: "secure", + component: () => + import(/* webpackChunkName: "secure" */ "./views/secure.vue") + }, + + // { + // path: "/", + // name: "home", + // component: Home + // }, { path: "/about", name: "about", diff --git a/app/ayanova/src/store.js b/app/ayanova/src/store.js index bb02ce2d..ceedaf67 100644 --- a/app/ayanova/src/store.js +++ b/app/ayanova/src/store.js @@ -4,7 +4,13 @@ import Vuex from "vuex"; Vue.use(Vuex); export default new Vuex.Store({ - state: {}, + state: { + authenticated: false, + mockAccount: { + username: "manager", + password: "letmein" + } + }, mutations: {}, actions: {} }); diff --git a/app/ayanova/src/views/login.vue b/app/ayanova/src/views/login.vue new file mode 100644 index 00000000..34266f9f --- /dev/null +++ b/app/ayanova/src/views/login.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/app/ayanova/src/views/secure.vue b/app/ayanova/src/views/secure.vue new file mode 100644 index 00000000..6c136802 --- /dev/null +++ b/app/ayanova/src/views/secure.vue @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file