Bind twofaccount data to OtpDisplay to prevent display lag

This commit is contained in:
Bubka 2023-11-15 15:31:23 +01:00
parent f3350e2dda
commit 21a7bfffa7

View File

@ -36,6 +36,12 @@
const isRenewingOTPs = ref(false) const isRenewingOTPs = ref(false)
const otpDisplay = ref(null) const otpDisplay = ref(null)
const otpDisplayProps = ref({
otp_type: '',
account : '',
service : '',
icon : '',
})
const looperRefs = ref([]) const looperRefs = ref([])
const dotsRefs = ref([]) const dotsRefs = ref([])
@ -126,8 +132,17 @@
twofaccounts.select(account.id) twofaccounts.select(account.id)
} }
else { else {
// Data that should be displayed quickly by the OtpDisplay
// component are passed using props.
otpDisplayProps.value.otp_type = account.otp_type
otpDisplayProps.value.service = account.service
otpDisplayProps.value.account = account.account
otpDisplayProps.value.icon = account.icon
nextTick().then(() => {
showOtpInModal.value = true showOtpInModal.value = true
otpDisplay.value.show(account.id); otpDisplay.value.show(account.id);
})
} }
} }
@ -317,6 +332,7 @@
<Modal v-model="showOtpInModal"> <Modal v-model="showOtpInModal">
<OtpDisplay <OtpDisplay
ref="otpDisplay" ref="otpDisplay"
v-bind="otpDisplayProps"
@please-close-me="showOtpInModal = false"> @please-close-me="showOtpInModal = false">
</OtpDisplay> </OtpDisplay>
</Modal> </Modal>