mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-06 20:43:13 +08:00
Added auth middleware. Added access control to apps
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||||
const App = require('../../models/App');
|
||||
const ErrorResponse = require('../../utils/ErrorResponse');
|
||||
|
||||
// @desc Delete app
|
||||
// @route DELETE /api/apps/:id
|
||||
// @access Public
|
||||
const deleteApp = asyncWrapper(async (req, res, next) => {
|
||||
if (!req.isAuthenticated) {
|
||||
return next(new ErrorResponse('Unauthorized', 401));
|
||||
}
|
||||
|
||||
await App.destroy({
|
||||
where: { id: req.params.id },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user