From 5abe8cba55965f70e07e1163239bcc9d797c864a Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 9 Jul 2022 15:22:44 +0200 Subject: Bye bye desktop app --- assets/delete.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 assets/delete.js (limited to 'assets/delete.js') diff --git a/assets/delete.js b/assets/delete.js new file mode 100644 index 0000000..1705640 --- /dev/null +++ b/assets/delete.js @@ -0,0 +1,14 @@ +async function deleteTransaction(id) { + let transaction = transactions.filter(i => i.date.absolute === id)[0]; + console.log(transaction); + showConfirm("This will remove the transaction made by " + transaction.author.name + " " + transaction.date.relative + ".\nIt will be removed from the list and the global balance will be recalculated without this transaction."); + confirmAction = async () => { + if (isNodeJS) { + await (await window.fetch("https://money-v1.equestria.dev/Application/RemoveTransaction/?Transaction=" + Buffer.from(id).toString("base64url"))).text(); + } else { + await (await window.fetch("https://money-v1.equestria.dev/Application/RemoveTransaction/?Transaction=" + btoa(id).replaceAll("+", "-").replaceAll("/", "_"))).text(); + } + await refresh(); + document.getElementById('confirm-modal').style.display = 'none'; + } +} \ No newline at end of file -- cgit