duplicated code for notes

This commit is contained in:
chris 2025-08-02 09:41:02 -04:00
parent a903e4b3de
commit 5e506e5ab6

View File

@ -352,21 +352,6 @@ app.delete('/api/admin/logs/:id', authenticateToken, requireRole('admin'), async
});
// Admin creates a note for an employee
async function handleAddNote(e) {
e.preventDefault();
const userId = e.target.elements['note-user-select'].value;
const noteText = e.target.elements['note-text'].value;
if (!userId) {
return showMessage('Please select an employee.', 'error');
}
const res = await apiCall('/api/admin/notes', 'POST', { userId, noteText });
if (res.success) {
showMessage(res.data.message, 'success');
e.target.reset();
}
}
app.post('/api/admin/notes', authenticateToken, requireRole('admin'), async (req, res) => {
try {
const { userId, noteText } = req.body;