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"> <section class="section">
<div class="container"> <div class="container">
<div class="notification"> <div class="notification">
Login Here Login Here...
</div>
<div class="notification">
{{ redirect }}
</div> </div>
</div> </div>
</section> </section>
@@ -22,7 +25,6 @@
</template> </template>
<script> <script>
import { isAuthenticated } from '../lib/authentication';
import TopNav from '../components/TopNav.vue'; import TopNav from '../components/TopNav.vue';
import store from '../store' import store from '../store'
@@ -31,12 +33,19 @@
components: { components: {
TopNav, TopNav,
}, },
data () { data() {
return { return {
sendTo: {}, 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 getRedirect = (query) => {
const { prev, redirect } = query; const { prev, redirect } = query;
if (redirect !== undefined) return { name: redirect }; if (redirect !== undefined) return { name: redirect };

View File

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