document.getElementById("followSignIn").addEventListener("click", handleFollowConnection);
document.getElementById("followForm").addEventListener("submit", handleFollowConnection);
document.getElementById("followSignOut").addEventListener("click", handleFollowDisconnection);


function handleFollowConnection(e) {
    e.preventDefault()
    const code = document.getElementById("inputFollowCode").value
    if (!code) {
        return;
    }
    sendMessage({
        kind: "follow",
        connectionCode: code
    })
    .then(response => {
        if (response) {
            getState();
        }
    });
}

function handleFollowDisconnection(e) {
    e.preventDefault();
    sendMessage({
        kind: "disconnectFollow",
    })
    .then(response => {
        if (response) {
            getState();
        }
    });
}

