✨ Add check for deletion of default config

This commit is contained in:
Manuel committed 2023-01-15 22:31:46 +01:00
1 parent 69199bdc9c
commit 0efc9ebb55
5 files changed
+42 -13

No files matched your search

+7
View File
@@ -136,6 +136,13 @@ function Delete(req: NextApiRequest, res: NextApiResponse<any>) {
});
}
if (slug.toLowerCase() === 'default') {
Consola.error('Rejected config deletion because default configuration can\'t be deleted');
return res.status(403).json({
message: 'Default config can\'t be deleted',
});
}
// Loop over all the files in the /data/configs directory
// Get all the configs in the /data/configs folder
// All the files that end in ".json"