Untitled

 avatar
unknown
plain_text
4 years ago
1.6 kB
8
Indexable
//client.js

const taskForm2 = document.querySelector('#taskForm2')
const name = document.querySelector('#Username1')
const Email = document.querySelector('#Email')

const { ipcRenderer } = require('electron')


taskForm2.addEventListener("submit",async e=>{
    e.preventDefault();
    const client={
      email:Email.value,
  clientName:name.value,
 
    }
    
 ipcRenderer.invoke('new-client', client).then(()=> console.log('new client entered')).catch((err)=> console.error('Error'))
 taskForm2.reset()
  })

  ipcRenderer.on("new-client-created", (e, arg) => {
    console.log(arg);
    const clientSaved = JSON.parse(arg);
    users.push(clientSaved);
   
    
  });
    
//client.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self';">
   
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="ui/style.css" />
  
  <title>New Client Registration</title>
</head>
<body>
  <h1>New Client Registration</h1>
    
    <form id="taskForm2">
     
      <br>
      
      <input type="text" id="Email" placeholder="Email" autofocus />
      <br>
     
      <input id="Username1" placeholder="clientName" autofocus />
      <br>
      
      <input type="Submit" placeholder="Save"/></button>
    </form>
    
  </div>
  <p class="para-2">
    <br>
    <a href="kargolist.html">Main Menu</a>
    <script  src="client.js"></script>
  </p>
</body>
</html>
Editor is loading...