Revert "make scan nfc button work"

This reverts commit a8ac90da5c.
This commit is contained in:
Lee Salminen 2022-08-29 08:39:02 -06:00
parent d7696fdc0f
commit 5dd6c0d2f4
2 changed files with 1 additions and 65 deletions

View File

@ -230,69 +230,6 @@ new Vue({
? '33333333333333333333333333333333'
: genRanHex(32)
},
readNfcTag: function () {
try {
const self = this
if (typeof NDEFReader == 'undefined') {
throw {
toString: function () {
return 'NFC not supported on this device or browser.'
}
}
}
const ndef = new NDEFReader()
const readerAbortController = new AbortController()
readerAbortController.signal.onabort = event => {
console.log('All NFC Read operations have been aborted.')
}
this.nfcTagReading = true
this.$q.notify({
message: 'Tap your NFC tag to read its UID'
})
return ndef.scan({signal: readerAbortController.signal}).then(() => {
ndef.onreadingerror = () => {
self.nfcTagReading = false
this.$q.notify({
type: 'negative',
message: 'There was an error reading this NFC tag.'
})
readerAbortController.abort()
}
ndef.onreading = ({message, serialNumber}) => {
self.nfcTagReading = false
self.cardDialog.data.uid = serialNumber
.replaceAll(':', '')
.toUpperCase()
this.$q.notify({
type: 'positive',
message: 'NFC tag read successfully.'
})
setTimeout(() => {
readerAbortController.abort()
}, 1000)
}
})
} catch (error) {
this.nfcTagReading = false
this.$q.notify({
type: 'negative',
message: error
? error.toString()
: 'An unexpected error has occurred.'
})
}
},
closeFormDialog: function () {
this.cardDialog.data = {}
},

View File

@ -278,8 +278,7 @@
color="grey"
icon="nfc"
:disable="nfcTagReading"
@click="readNfcTag"
><q-tooltip>Tap card to scan UID</q-tooltip></q-btn
><q-tooltip>Tap card to scan UID (coming soon)</q-tooltip></q-btn
>
</div>
</div>