Auth

<jira-auth id="jira-auth"></jira-auth>

<hr>
<form onsubmit="return false">
    <div>
        <label>Email:</label>
        <input type="email" id="email" value="">
    </div>
    <div>
        <label>Api key:</label>
        <input type="password" id="apiKey" value="">
    </div>
    <div>
        <label>URL:</label>
        <input type="text" id="url" value="">
    </div>
    <div>
        <button onclick="authenticate()">Save</button>
    </div>
</form>
<hr>

<script>
    var auth = document.getElementById('jira-auth');
    window.onload = () => {
        auth.$on('jira-auth-user-changed', function(e) {
            console.log(e.detail)
        });
        auth.$on('jira-auth-user-fetching-changed', function(e) {
            console.log(e.detail);
        });
        auth.$on('jira-auth-status-changed', function(e) {
            console.log(e.detail)
        });
        auth.$on('jira-auth-email-changed', function(e) {
            console.log(e.detail)
        });
        auth.$on('jira-auth-apikey-changed', function(e) {
            console.log(e.detail)
        });
        auth.$on('jira-auth-url-changed', function(e) {
            console.log(e.detail)
        });
        document.getElementById('email').value = auth.getEmail();
        document.getElementById('apiKey').value = auth.getApiKey();
        document.getElementById('url').value = auth.getUrl();
    };
    var authenticate = () => {
        auth.setEmail(document.getElementById('email').value);
        auth.setApiKey(document.getElementById('apiKey').value);
        auth.setUrl(document.getElementById('url').value);
        return false;
    }
</script>
<jira-auth id="{{ id }}"></jira-auth>

<hr>
<form onsubmit="return false">
  <div>
    <label>Email:</label>
    <input type="email" id="email" value="">
  </div>
  <div>
    <label>Api key:</label>
    <input type="password" id="apiKey" value="">
  </div>
  <div>
    <label>URL:</label>
    <input type="text" id="url" value="">
  </div>
  <div>
    <button onclick="authenticate()">Save</button>
  </div>
</form>
<hr>

<script>
  var auth = document.getElementById('{{ id }}');

  window.onload = () => {
    auth.$on('jira-auth-user-changed', function(e) { console.log(e.detail) });
    auth.$on('jira-auth-user-fetching-changed', function(e) {console.log(e.detail); });
    auth.$on('jira-auth-status-changed', function(e) { console.log(e.detail) });
    auth.$on('jira-auth-email-changed', function(e) { console.log(e.detail) });
    auth.$on('jira-auth-apikey-changed', function(e) { console.log(e.detail) });
    auth.$on('jira-auth-url-changed', function(e) { console.log(e.detail) });
    
    document.getElementById('email').value = auth.getEmail();
    document.getElementById('apiKey').value = auth.getApiKey();
    document.getElementById('url').value = auth.getUrl();
  };
  

  var authenticate = () => {
    auth.setEmail(document.getElementById('email').value);
    auth.setApiKey(document.getElementById('apiKey').value);
    auth.setUrl(document.getElementById('url').value);
    return false;
  }
</script>
{
  "id": "jira-auth"
}

There are no notes for this item.