Код: Выделить всё
bcrypt.hash(password, 13)
.then(res => {
axios.post('http://localhost:8081/register', { email, res })
.then(res => console.log(res))
.catch(err => console.log(err))
})
.catch(err => console.log(err))< /code>
< /div>
< /div>
< /p>
Несмотря на блок. . Это тот код: < /p>
const handleRegistration = async (e) => {
e.preventDefault();
if (password !== confPassword) {
console.log("Passwords must match.");
alert("Passwords must match!");
return;
}
const hashedPassword = await bcrypt.hash(password, 13)
//Call POST api here
await axios.post('http://localhost:8081/register', { email, hashedPassword })
.then(res => console.log(res))
.catch(err => console.log(err))
};Это также не работает.
Подробнее здесь: https://stackoverflow.com/questions/794 ... sh-hashing