move mfa.js to the rest of the API
This commit is contained in:
parent
61f93ad955
commit
7a02ae396e
4 changed files with 64 additions and 72 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { mapActions, mapState, mapStores } from 'pinia'
|
||||
|
||||
import mfaApi from '../../services/new_api/mfa.js'
|
||||
import { verifyRecoveryCode } from 'src/api/mfa.js'
|
||||
|
||||
import { useAuthFlowStore } from 'src/stores/auth_flow.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -43,18 +43,18 @@ export default {
|
|||
code: this.code,
|
||||
}
|
||||
|
||||
mfaApi.verifyRecoveryCode(data).then((result) => {
|
||||
if (result.error) {
|
||||
this.error = result.error
|
||||
verifyRecoveryCode(data)
|
||||
.then((result) => {
|
||||
this.login(result).then(() => {
|
||||
this.$router.push({ name: 'friends' })
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.error = error
|
||||
this.code = null
|
||||
this.focusOnCodeInput()
|
||||
return
|
||||
}
|
||||
|
||||
this.login(result).then(() => {
|
||||
this.$router.push({ name: 'friends' })
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mapActions, mapState, mapStores } from 'pinia'
|
||||
|
||||
import mfaApi from '../../services/new_api/mfa.js'
|
||||
import { verifyOTPCode } from 'src/api/mfa.js'
|
||||
|
||||
import { useAuthFlowStore } from 'src/stores/auth_flow.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -46,18 +46,18 @@ export default {
|
|||
code: this.code,
|
||||
}
|
||||
|
||||
mfaApi.verifyOTPCode(data).then((result) => {
|
||||
if (result.error) {
|
||||
this.error = result.error
|
||||
verifyOTPCode(data)
|
||||
.then(({ data: result }) => {
|
||||
this.login(result).then(() => {
|
||||
this.$router.push({ name: 'friends' })
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.error = error
|
||||
this.code = null
|
||||
this.focusOnCodeInput()
|
||||
return
|
||||
}
|
||||
|
||||
this.login(result).then(() => {
|
||||
this.$router.push({ name: 'friends' })
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue