mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-19 19:28:08 +02:00
Show accounts (or no account prompt) after API response
This commit is contained in:
parent
9b30f3fe83
commit
2e642c2a3e
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="container" v-if="this.accounts.length > 0">
|
<div class="container" v-if="this.showAccounts">
|
||||||
<div class="buttons are-large is-centered">
|
<div class="buttons are-large is-centered">
|
||||||
<span v-for="account in accounts" class="button is-black twofaccount" >
|
<span v-for="account in accounts" class="button is-black twofaccount" >
|
||||||
<span @click.stop="getAccount(account.id)">
|
<span @click.stop="getAccount(account.id)">
|
||||||
@ -19,7 +19,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container has-text-centered" v-else>
|
<div class="container has-text-centered" v-show="this.showNoAccount">
|
||||||
<p>
|
<p>
|
||||||
<img class="bg" src="storage/bg.png">
|
<img class="bg" src="storage/bg.png">
|
||||||
</p>
|
</p>
|
||||||
@ -92,7 +92,9 @@
|
|||||||
twofaccount: {},
|
twofaccount: {},
|
||||||
token : null,
|
token : null,
|
||||||
username : null,
|
username : null,
|
||||||
editMode: this.InitialEditMode
|
editMode: this.InitialEditMode,
|
||||||
|
showAccounts: null,
|
||||||
|
showNoAccount: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -114,6 +116,8 @@
|
|||||||
icon : data.icon
|
icon : data.icon
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
this.showAccounts = this.accounts.length > 0 ? true : false
|
||||||
|
this.showNoAccount = !this.showAccounts
|
||||||
})
|
})
|
||||||
|
|
||||||
// stop OTP generation on modal close
|
// stop OTP generation on modal close
|
||||||
@ -129,6 +133,7 @@
|
|||||||
TwofaccountShow,
|
TwofaccountShow,
|
||||||
OneTimePassword
|
OneTimePassword
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getAccount: function (id) {
|
getAccount: function (id) {
|
||||||
let accountId = id
|
let accountId = id
|
||||||
@ -158,6 +163,9 @@
|
|||||||
|
|
||||||
axios.delete('/api/twofaccounts/' + id).then(response => {
|
axios.delete('/api/twofaccounts/' + id).then(response => {
|
||||||
this.accounts.splice(this.accounts.findIndex(x => x.id === id), 1);
|
this.accounts.splice(this.accounts.findIndex(x => x.id === id), 1);
|
||||||
|
|
||||||
|
this.showAccounts = this.accounts.length > 0 ? true : false
|
||||||
|
this.showNoAccount = !this.showAccounts
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -181,6 +189,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeRouteEnter (to, from, next) {
|
beforeRouteEnter (to, from, next) {
|
||||||
if ( ! localStorage.getItem('jwt')) {
|
if ( ! localStorage.getItem('jwt')) {
|
||||||
return next('login')
|
return next('login')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user