This commit is contained in:
Nikola Petrov 2023-10-12 22:37:29 +02:00
parent 6d3dcc773d
commit 2b0572c140
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ module.exports = {
remove: async function (req, res) { remove: async function (req, res) {
try { try {
await userFound.remove(); await UserModel.deleteMany();
return res.status(204).json({ message: 'User deleted' }); return res.status(204).json({ message: 'User deleted' });
} catch (err) { } catch (err) {
return res.status(500).json({ message: 'Error when deleting the user', error: err }); return res.status(500).json({ message: 'Error when deleting the user', error: err });

View File

@ -39,7 +39,7 @@
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ "password": password }), body: JSON.stringify({ "pass": password }),
}) })
const data = await response.json(); const data = await response.json();
document.getElementById('text').innerHTML = data.message; document.getElementById('text').innerHTML = data.message;
@ -52,7 +52,7 @@
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ "password": password }), body: JSON.stringify({ "pass": password }),
}) })
const data = await response.json(); const data = await response.json();
document.getElementById('text').textContent = JSON.stringify(data, null, 2); document.getElementById('text').textContent = JSON.stringify(data, null, 2);