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} response - Express response object.
*/
app.post('/recreatestats', jsonParser, function (request, response) {
if (statsHelpers.loadStatsFile(DIRECTORIES.chats, DIRECTORIES.characters, true)) {
app.post('/recreatestats', jsonParser, async function (request, response) {
try {
await statsHelpers.loadStatsFile(DIRECTORIES.chats, DIRECTORIES.characters, true);
return response.sendStatus(200);
} else {
} catch (error) {
console.error(error);
return response.sendStatus(500);
}
});
/**
* Handle a POST request to update the stats object
*