Skip to content

Commit

Permalink
fix: user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yayacat committed Mar 30, 2024
1 parent 31b953f commit ca8854f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/scripts/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ submit.addEventListener("click", (e) => {
})
.then(async res => {
if (res.ok) {
window.location.href = `./user.html?key=${await res.text()}`;
window.location.href = `./user.html?key=${await res.text()}&email=${values.email}`;
} else {
switch (await res.text()) {
case "Invaild email!": {
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Pay(type) {
pay_1.style.display = "none";
pay_2.style.display = "none";
pay_3.style.display = "none";
fetch(`${base_url}/api/v1/et/pay?type=${type}&key=${params.key}`)
fetch(`${base_url}/api/v3/et/pay?type=${type}&key=${params.key}`)
.then(async res => {
document.getElementById("pay-button").textContent = `NTD ${(type == 1) ? "100" : (type == 2) ? "500" : "1000"} 前往付款`;
const data = await res.json();
Expand Down Expand Up @@ -102,7 +102,7 @@ const toTimeString = (timestamp) => {
].join("");
};

fetch(`${base_url}/api/v1/et/service-info`)
fetch(`${base_url}/api/v3/et/service-info`)
.then(async res => {
const data = await res.json();
service_list = data.list;
Expand Down Expand Up @@ -313,7 +313,7 @@ function ColorCode() {
}

const toggleService = (type, status) => {
fetch(`${base_url}/api/v1/et/${(!status) ? "subscribe" : "unsubscribe"}?key=${params.key}&type=${type}`)
fetch(`${base_url}/api/v3/et/${(!status) ? "subscribe" : "unsubscribe"}?key=${params.key}&type=${type}`)
.then(res => {
if (res.ok)
refresh();
Expand All @@ -333,7 +333,7 @@ const copy = (key) => {
};

const deleteKey = (key) => {
fetch(`${base_url}/api/v1/et/key-remove?key=${params.key}`)
fetch(`${base_url}/api/v3/et/key-remove?key=${params.key}`)
.then(res => {
if (res.ok)
refresh();
Expand Down Expand Up @@ -500,7 +500,7 @@ function reload_service() {
}

create.onclick = () => {
fetch(`${base_url}/api/v1/et/key-add`, {
fetch(`${base_url}/api/v3/et/key-add`, {
method : "POST",
headers : { "Content-Type": "application/json" },
body : JSON.stringify({
Expand All @@ -523,7 +523,7 @@ document.getElementById("logout").addEventListener("click", function() {
document.body.style.pointerEvents = "none";
this.disabled = true;
this.classList.add("loading");
fetch(`${base_url}/api/v1/et/logout?key=${params.key}`)
fetch(`${base_url}/api/v3/et/logout?key=${params.key}&email=${params.email}`)
.then(res => {
if (res.ok)
window.location.replace("./login.html");
Expand Down

0 comments on commit ca8854f

Please sign in to comment.