upgrade quasar api calls

This commit is contained in:
Riccardo Balbo 2025-02-17 20:00:19 +00:00
commit 4a8303b049
2 changed files with 31 additions and 23 deletions

View file

@ -43,8 +43,8 @@ window.app = Vue.createApp({
value: value, value: value,
}); });
} }
this.entries.length = 0;
this.entries = newEntries; this.entries.push(...newEntries);
}) })
.catch(function (error) { .catch(function (error) {
console.error("Error fetching config:", error); console.error("Error fetching config:", error);
@ -62,14 +62,19 @@ window.app = Vue.createApp({
this.g.user.wallets[0].adminkey, this.g.user.wallets[0].adminkey,
data, data,
); );
this.$q.notify({ Quasar.Notify.create({
message: "Config saved, please restart the server", type: 'positive',
color: "positive", message: 'Config saved!',
position: "top", });
timeout: 2000, Quasar.Notify.create({
actions: [{ icon: "close", color: "white" }], type: 'warning',
message: 'You need to restart the server for the changes to take effect!',
}); });
} catch (error) { } catch (error) {
Quasar.Notify.create({
type: 'negative',
message: "Error saving config: "+String(error),
})
console.error("Error saving config:", error); console.error("Error saving config:", error);
} }
}, },

View file

@ -66,9 +66,9 @@
showConnectDialog() { showConnectDialog() {
const wallet = this.getWallet(); const wallet = this.getWallet();
if (!wallet) { if (!wallet) {
this.$q.notify({ Quasar.Notify.create({
color: "red", type: 'negative',
message: "Please select a wallet first", message: 'Please select a wallet first',
}); });
return; return;
} else { } else {
@ -94,12 +94,15 @@
if (url) { if (url) {
try { try {
await navigator.clipboard.writeText(url); await navigator.clipboard.writeText(url);
this.$q.notify({ Quasar.Notify.create({
color: "primary", type: "positive",
message: "URL copied to clipboard!", message: "URL copied to clipboard"
}); });
} catch (err) { } catch (err) {
this.$q.notify({ color: "red", message: "Failed to copy URL." }); Quasar.Notify.create({
type: "negative",
message: "Failed to copy URL."
});
} }
} }
}, },
@ -168,8 +171,8 @@
return out; return out;
}, },
deleteNWC: async function (pubkey) { deleteNWC: async function (pubkey) {
this.$q Quasar
.dialog({ .Dialog.create({
title: "Confirm Deletion", title: "Confirm Deletion",
message: "Are you sure you want to delete this connection?", message: "Are you sure you want to delete this connection?",
cancel: true, cancel: true,
@ -184,9 +187,9 @@
wallet.adminkey, wallet.adminkey,
); );
this.loadNwcs(); this.loadNwcs();
this.$q.notify({ Quasar.Notify.create({
type: "positive", type: "positive",
message: "Deleted successfully", message: "Deleted successfully"
}); });
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error); LNbits.utils.notifyApiError(error);
@ -233,18 +236,18 @@
this.loadConnectDialogData(); this.loadConnectDialogData();
const newTableEntries = []; const newTableEntries = [];
for (const nwc of this.nwcs) { for (const nwc of this.nwcs) {
const t = Quasar.utils.date.formatDate( const t = Quasar.date.formatDate(
new Date(nwc.data.created_at * 1000), new Date(nwc.data.created_at * 1000),
"YYYY-MM-DD HH:mm", "YYYY-MM-DD HH:mm",
); );
const e = const e =
nwc.data.expires_at > 0 nwc.data.expires_at > 0
? Quasar.utils.date.formatDate( ? Quasar.date.formatDate(
new Date(nwc.data.expires_at * 1000), new Date(nwc.data.expires_at * 1000),
"YYYY-MM-DD HH:mm", "YYYY-MM-DD HH:mm",
) )
: "Never"; : "Never";
const l = Quasar.utils.date.formatDate( const l = Quasar.date.formatDate(
new Date(nwc.data.last_used * 1000), new Date(nwc.data.last_used * 1000),
"YYYY-MM-DD HH:mm", "YYYY-MM-DD HH:mm",
); );
@ -265,7 +268,7 @@
nwcTableEntry.status = "Expired"; nwcTableEntry.status = "Expired";
} }
for (const budget of nwc.budgets) { for (const budget of nwc.budgets) {
const createdAt = Quasar.utils.date.formatDate( const createdAt = Quasar.date.formatDate(
new Date(budget.created_at * 1000), new Date(budget.created_at * 1000),
"YYYY-MM-DD HH:mm", "YYYY-MM-DD HH:mm",
); );