mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-06-17 13:15:22 +02:00
fix: missing await on Node fs.writeFile() method
This commit is contained in:
parent
1f2711ee88
commit
182b2821e9
|
@ -59,9 +59,13 @@ export default async function handler(req, res) {
|
||||||
//Stringify the new users list
|
//Stringify the new users list
|
||||||
newUsersList = JSON.stringify(newUsersList);
|
newUsersList = JSON.stringify(newUsersList);
|
||||||
//Write the new JSON
|
//Write the new JSON
|
||||||
fs.writeFile(jsonDirectory + '/users.json', newUsersList, (err) => {
|
await fs.writeFile(
|
||||||
if (err) console.log(err);
|
jsonDirectory + '/users.json',
|
||||||
});
|
newUsersList,
|
||||||
|
(err) => {
|
||||||
|
if (err) console.log(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
res.status(200).json({ message: 'Successful API send' });
|
res.status(200).json({ message: 'Successful API send' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//Log for backend
|
//Log for backend
|
||||||
|
|
Loading…
Reference in a new issue