refactor: Shorten input focus calls

Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
Christopher Ng 2024-05-14 15:08:39 -07:00
parent 76104aa709
commit fad49e6aee

View file

@ -280,7 +280,7 @@ export default {
})
this.$emit('reset')
this.$refs.username?.$refs?.inputField?.$refs?.input?.focus?.()
this.$refs.username?.focus?.()
this.$emit('closing')
} catch (error) {
this.loading.all = false
@ -288,10 +288,10 @@ export default {
const statuscode = error.response.data.ocs.meta.statuscode
if (statuscode === 102) {
// wrong username
this.$refs.username?.$refs?.inputField?.$refs?.input?.focus?.()
this.$refs.username?.focus?.()
} else if (statuscode === 107) {
// wrong password
this.$refs.password?.$refs?.inputField?.$refs?.input?.focus?.()
this.$refs.password?.focus?.()
}
}
}