This commit is contained in:
Tiago Vasconcelos 2022-10-25 12:32:19 +01:00
parent 45ef9222fe
commit f3fc1e4a2b
2 changed files with 33 additions and 23 deletions

View file

@ -1953,21 +1953,21 @@
}) })
}) })
}, },
shipOrder(order_id){ shipOrder(order_id) {
LNbits.api LNbits.api
.request( .request(
'GET', 'GET',
'/diagonalley/api/v1/orders/shipped/' + order_id, '/diagonalley/api/v1/orders/shipped/' + order_id,
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then((response) => { .then(response => {
console.log(response.data) console.log(response.data)
this.orders = _.reject(this.orders, (obj) => { this.orders = _.reject(this.orders, obj => {
return obj.id == order_id return obj.id == order_id
}) })
this.orders.push(mapOrders(response.data)) this.orders.push(mapOrders(response.data))
}) })
.catch((error) => { .catch(error => {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
}, },
@ -2022,7 +2022,7 @@
this.updateLastSeenMsg(key) this.updateLastSeenMsg(key)
return return
} }
if ( if (
lastMsgs[key].timestamp < lastMsgs[key].timestamp <
Math.max(...this.messages[key].map(c => c.timestamp)) Math.max(...this.messages[key].map(c => c.timestamp))

View file

@ -137,11 +137,21 @@
>Backup keys >Backup keys
<q-tooltip>Download your keys</q-tooltip> <q-tooltip>Download your keys</q-tooltip>
</q-btn> </q-btn>
<q-btn outline color="grey" class="q-mx-sm" @click="keysDialog.show = true" :disabled="this.user.keys" <q-btn
outline
color="grey"
class="q-mx-sm"
@click="keysDialog.show = true"
:disabled="this.user.keys"
>Restore keys >Restore keys
<q-tooltip>Restore keys</q-tooltip> <q-tooltip>Restore keys</q-tooltip>
</q-btn> </q-btn>
<q-btn @click="deleteData" v-close-popup flat color="grey" class="q-ml-auto" <q-btn
@click="deleteData"
v-close-popup
flat
color="grey"
class="q-ml-auto"
>Delete data >Delete data
<q-tooltip>Delete all data from browser</q-tooltip> <q-tooltip>Delete all data from browser</q-tooltip>
</q-btn> </q-btn>
@ -155,10 +165,7 @@
position="top" position="top"
@hide="clearRestoreKeyDialog" @hide="clearRestoreKeyDialog"
> >
<q-card <q-card class="q-pa-lg q-pt-xl lnbits__dialog-card"> </q-card>
class="q-pa-lg q-pt-xl lnbits__dialog-card"
>
</q-card>
<q-card class="q-pa-lg lnbits__dialog-card"> <q-card class="q-pa-lg lnbits__dialog-card">
<q-form @submit="restoreKeys" class="q-gutter-md"> <q-form @submit="restoreKeys" class="q-gutter-md">
<q-input <q-input
@ -180,7 +187,7 @@
:disable="keysDialog.data.publickey == null" :disable="keysDialog.data.publickey == null"
type="submit" type="submit"
label="Submit" label="Submit"
></q-btn> ></q-btn>
<q-btn <q-btn
v-close-popup v-close-popup
flat flat
@ -188,9 +195,9 @@
color="grey" color="grey"
class="q-ml-auto" class="q-ml-auto"
label="Cancel" label="Cancel"
></q-btn> ></q-btn>
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</div> </div>
@ -230,7 +237,7 @@
this.newMessage = '' this.newMessage = ''
this.$refs.newMessage.focus() this.$refs.newMessage.focus()
}, },
clearRestoreKeyDialog(){ clearRestoreKeyDialog() {
this.keysDialog = { this.keysDialog = {
show: false, show: false,
data: {} data: {}
@ -249,10 +256,14 @@
if (!key) return '' if (!key) return ''
return `${key.slice(0, 4)}...${key.slice(-4)}` return `${key.slice(0, 4)}...${key.slice(-4)}`
}, },
downloadKeys(){ downloadKeys() {
const file = new File([JSON.stringify(this.user.keys)], 'backup_keys.json', { const file = new File(
type: 'text/json', [JSON.stringify(this.user.keys)],
}) 'backup_keys.json',
{
type: 'text/json'
}
)
const link = document.createElement('a') const link = document.createElement('a')
const url = URL.createObjectURL(file) const url = URL.createObjectURL(file)
@ -261,19 +272,18 @@
link.click() link.click()
window.URL.revokeObjectURL(url) window.URL.revokeObjectURL(url)
}, },
restoreKeys(){ restoreKeys() {
this.user.keys = this.keysDialog.data this.user.keys = this.keysDialog.data
let data = this.$q.localStorage.getItem(`lnbits.diagonalley.data`) let data = this.$q.localStorage.getItem(`lnbits.diagonalley.data`)
this.$q.localStorage.set(`lnbits.diagonalley.data`, { this.$q.localStorage.set(`lnbits.diagonalley.data`, {
...data, ...data,
keys: this.user.keys keys: this.user.keys
}) })
this.clearRestoreKeyDialog() this.clearRestoreKeyDialog()
}, },
deleteData(){ deleteData() {
LNbits.utils LNbits.utils
.confirmDialog('Are you sure you want to delete your stored data?') .confirmDialog('Are you sure you want to delete your stored data?')
.onOk(() => { .onOk(() => {