update Login to be able to force-reload the page

This commit is contained in:
axolotle 2021-11-10 19:10:59 +01:00
parent 490092afee
commit 246c001f84
2 changed files with 9 additions and 3 deletions

View file

@ -103,7 +103,6 @@ export default {
'CONNECT' ({ commit, dispatch }) {
commit('SET_CONNECTED', true)
dispatch('GET_YUNOHOST_INFOS')
router.push(router.currentRoute.query.redirect || { name: 'home' })
},
'RESET_CONNECTED' ({ commit }) {

View file

@ -33,7 +33,8 @@ export default {
name: 'Login',
props: {
skipInstallCheck: { type: Boolean, default: false }
skipInstallCheck: { type: Boolean, default: false },
forceReload: { type: Boolean, default: false }
},
data () {
@ -47,7 +48,13 @@ export default {
methods: {
login () {
this.$store.dispatch('LOGIN', this.password).catch(err => {
this.$store.dispatch('LOGIN', this.password).then(() => {
if (this.forceReload) {
window.location.href = '/yunohost/admin/'
} else {
this.$router.push(this.$router.currentRoute.query.redirect || { name: 'home' })
}
}).catch(err => {
if (err.name !== 'APIUnauthorizedError') throw err
this.isValid = false
})