duplicated code for notes
This commit is contained in:
parent
a903e4b3de
commit
5e506e5ab6
15
server.js
15
server.js
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user