OpenID/SSO: Implement Logout functionality

This commit is contained in:
Denis Arnst 2024-01-24 22:47:50 +01:00
parent 3906dca04e
commit 87ebf4722b
2 changed files with 87 additions and 39 deletions

View file

@ -86,15 +86,24 @@ export default {
const logoutPayload = {
socketId: rootSocket.id
}
this.$axios.$post('/logout', logoutPayload).catch((error) => {
console.error(error)
})
if (localStorage.getItem('token')) {
localStorage.removeItem('token')
}
this.$store.commit('libraries/setUserPlaylists', [])
this.$store.commit('libraries/setCollections', [])
this.$router.push('/login')
this.$axios.$post('/logout').then((logoutPayload) => {
const redirect_url = logoutPayload.redirect_url
if (redirect_url) {
window.location.href = redirect_url
} else {
this.$router.push('/login')
}
}).catch((error) => {
console.error(error)
})
},
resetForm() {
this.password = null