1 | module.exports = ({
|
2 | Settings,
|
3 | router,
|
4 | authMiddleware,
|
5 | permissionMiddleware,
|
6 | asyncMiddleware,
|
7 | getConfig,
|
8 | handleResponse,
|
9 | handleError,
|
10 | }) => {
|
11 |
|
12 | router.post(
|
13 | '/settings.:ext?',
|
14 | authMiddleware,
|
15 | permissionMiddleware.bind(null, 'settings'),
|
16 | asyncMiddleware(async (req, res) => {
|
17 | const settings = Settings(await getConfig(req.session.slug));
|
18 |
|
19 | try {
|
20 | handleResponse(req, res, await settings.update(req.body.settings));
|
21 | } catch (error) {
|
22 | handleError(req, res, error);
|
23 | }
|
24 | })
|
25 | );
|
26 |
|
27 | };
|