async function sendUser(url,name,email,role,password) {
this.url = url
this.name = name
this.email = email
this.role = role
this.password = password
this.options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body:
JSON.stringify({
firstname: this.name,
email: this.email,
role: this.role,
password: this.password
})
}
const response = await fetch(this.url,this.options)
const data = await response.json()
if(data) document.location.replace(`${data.step}`)
}
async function authenticateForUser(url,email,password) {
this.url = url
this.email = email
this.password = password
this.options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body:
JSON.stringify({
email: this.email,
password: this.password
})
}
const response = await fetch(this.url,this.options)
const data = await response.json()
// if(data) document.location.replace(`${data.step}`)
}
await pool.query('insert into users set ?', { email, firstname, password: pass, role })
Password = NULL