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
    }
    chrome.runtime.sendMessage({
        kind: "follow",
        connectionCode: code
    }, {}, response => {
        if (response) {
            getState();
        }
    });
}

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

