I am trying to redirect the user by clicking the exit link to the page displayed on the server. But since it stands with the code below, I am simply redirecting to the default path.
I have a server route setup in a bulb as follows:
@app.route('/logout')
def logout():
logout_user()
return render_template('login.html')
In vue, I want to redirect the route so that I am directed to the server route.
<template>
<a v-on:click="logout">Logout</a>
</template>
<script>
export default {
name: SomePage.vue
},
methods: {
logout () {
this.$router.replace('/logout')
}
}
</script>
Then I need to configure the route in my router?
export default new Router {
routes: {
{
path: '/'
component: Default
children: [
{
path: '/logout'
// no component added here - is it needed?
}
]
}
}
Since I'm already redirected to / logout, I'm not sure how to add a component for this route, since I just want to go to the base / logout and get the .html page returned by the server. Any ideas?
source
share