mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-17 17:11:06 +02:00
Move Account getter to Twofaccount component (to fix)
This commit is contained in:
@@ -16,19 +16,38 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
service: '',
|
||||
account: '',
|
||||
icon: '',
|
||||
totp : '',
|
||||
timerID: null,
|
||||
position: null,
|
||||
AccountId : null
|
||||
}
|
||||
},
|
||||
|
||||
props: ['twofaccountid', 'service', 'account', 'icon'],
|
||||
props: ['twofaccountid'],
|
||||
|
||||
methods: {
|
||||
getOTP: function () {
|
||||
|
||||
axios.get('api/twofaccounts/' + this.AccountId + '/totp').then(response => {
|
||||
getAccount: function() {
|
||||
|
||||
axios.get('api/twofaccounts/' + this.twofaccountid)
|
||||
.then(response => {
|
||||
|
||||
this.service = response.data.service
|
||||
this.account = response.data.account
|
||||
this.icon = response.data.icon
|
||||
|
||||
this.getOTP(this.twofaccountid)
|
||||
})
|
||||
.catch(error => {
|
||||
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||
});
|
||||
},
|
||||
|
||||
getOTP: function(id) {
|
||||
|
||||
axios.get('api/twofaccounts/' + id + '/totp').then(response => {
|
||||
let spacePosition = Math.ceil(response.data.totp.length / 2);
|
||||
|
||||
this.totp = response.data.totp.substr(0, spacePosition) + " " + response.data.totp.substr(spacePosition);
|
||||
|
Reference in New Issue
Block a user