#functions
10 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by OP
the error literally says it all right there
const history = require("../database/history")
async function updateUserHistory(memberId, action, moderatorId, reason) {
try {
const exuser = await history.findOne({ userId: memberId });
if (exuser) {
exuser.history.push({
action: action,
moderatorId: moderatorId,
reason: reason,
timestamp: new Date()
});
await exuser.save();
} else {
const newUser = new history({
userId: memberId,
history: [{
action: action,
moderatorId: moderatorId,
reason: reason,
timestamp: new Date()
}]
});
await newUser.save();
}
} catch (error) {
console.error('Fout bij het bijwerken van de gebruikersgeschiedenis:', error);
throw error; // Opnieuw gooien zodat de aanroepende functie dit kan afhandelen
}
}
// Exporteer de updateUserHistory functie
module.exports = updateUserHistory ;
you're attempting to call a function which doesn't exist
THis is the function
module.exports needs to be an object afaik
{}?
also show the file in which you're calling it
yes