Add awaiter to /recreatestats

This commit is contained in:
Cohee
2023-12-07 01:06:56 +02:00
parent f3ae2e4046
commit 1683b76c65
2 changed files with 6 additions and 5 deletions

View File

@@ -877,16 +877,17 @@ app.post('/getstats', jsonParser, function (request, response) {
* @param {Object} request - Express request object. * @param {Object} request - Express request object.
* @param {Object} response - Express response object. * @param {Object} response - Express response object.
*/ */
app.post('/recreatestats', jsonParser, function (request, response) { app.post('/recreatestats', jsonParser, async function (request, response) {
if (statsHelpers.loadStatsFile(DIRECTORIES.chats, DIRECTORIES.characters, true)) { try {
await statsHelpers.loadStatsFile(DIRECTORIES.chats, DIRECTORIES.characters, true);
return response.sendStatus(200); return response.sendStatus(200);
} else { } catch (error) {
console.error(error);
return response.sendStatus(500); return response.sendStatus(500);
} }
}); });
/** /**
* Handle a POST request to update the stats object * Handle a POST request to update the stats object
* *