import { decodeAccessKey } from "../net/api.js";
import { t } from "../i18n.js";
document.addEventListener("alpine:init", () => {
Alpine.data("login", () => ({
get store() {
return Alpine.store("app");
},
get otherServerWarning() {
const decodedKey = decodeAccessKey(this.store.accessKey);
if (!decodedKey) return "";
const here = window.location.hostname + ":" + (window.location.port || (window.location.protocol === "https:" ? "443" : "80"));
return decodedKey.address === here ? "" : t("este token é de ") + decodedKey.address + t(" — você está em ") + here;
},
submit() {
this.store.connect();
},
}));
});