Add authentication on payement

This commit is contained in:
2025-12-09 16:20:42 +01:00
parent 6c14c41bbd
commit 64e64373ce
3 changed files with 5 additions and 42 deletions

View File

@@ -100,15 +100,17 @@
btnPay.addEventListener("click", async() => {
let token = document.getElementById("token-input").value;
let dataToken = {
token: token
};
let creds = JSON.parse(localStorage.getItem("creds"));
await fetch("/payment", {
method: "POST",
headers: {
"Content-Type": "application/json"
"Content-Type": "application/json",
"Authorization": `Basic ${creds.username}:${creds.password}`
},
body: JSON.stringify(dataToken)
})