fix the login component auth hook

This commit is contained in:
2017-02-20 11:54:03 -07:00
parent 1ec52a3de1
commit 4caae2828b
2 changed files with 14 additions and 4 deletions

View File

@@ -14,7 +14,10 @@
<section class="section">
<div class="container">
<div class="notification">
Login Here
Login Here...
</div>
<div class="notification">
{{ redirect }}
</div>
</div>
</section>
@@ -22,7 +25,6 @@
</template>
<script>
import { isAuthenticated } from '../lib/authentication';
import TopNav from '../components/TopNav.vue';
import store from '../store'
@@ -31,12 +33,19 @@
components: {
TopNav,
},
data () {
data() {
return {
sendTo: {},
};
},
beforeCreate() {
computed: {
redirect: function() {
return Object.keys(this.sendTo).reduce((str, val) => {
return str += `${val}: ${this.sendTo[val]}; `;
}, 'REDIRECT: ');
},
},
created() {
const getRedirect = (query) => {
const { prev, redirect } = query;
if (redirect !== undefined) return { name: redirect };

View File

@@ -35,6 +35,7 @@ const routes = [{
name: 'about',
component: About,
}, {
// all other routes, including /, get redirected to /customers
path: '*',
redirect: 'customers',
},