fix the login component auth hook
This commit is contained in:
@@ -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'
|
||||||
|
|
||||||
@@ -36,7 +38,14 @@
|
|||||||
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 };
|
||||||
|
|||||||
@@ -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',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user