summaryrefslogtreecommitdiff
path: root/app/bits/assets/delete.js
blob: 0c6ce5e22f4d9d4eabe32b593e442f453dd3e261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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://ponies.equestria.horse/bits/Application/RemoveTransaction/index.php?Transaction=" + Buffer.from(id).toString("base64url"))).text();
        } else {
            await (await window.fetch("https://ponies.equestria.horse/bits/Application/RemoveTransaction/index.php?Transaction=" + btoa(id).replaceAll("+", "-").replaceAll("/", "_"))).text();
        }
        await refresh();
        deleteDialog.close();
    }
}