const input = document.querySelector("#api");
const button = document.querySelector("#save");
const DEFAULT_API = "https://veersec.io";
const stored = await chrome.storage.local.get(["veersecApiBase"]);
input.value = stored.veersecApiBase || DEFAULT_API;
button.addEventListener("click", async () => {
  await chrome.storage.local.set({ veersecApiBase: input.value.replace(/\/$/, "") });
  button.textContent = "Saved";
  setTimeout(() => { button.textContent = "Save API address"; }, 1200);
});
