|
@ -71,17 +71,27 @@ class SettingsController extends SiteController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async postUpdateSiteIcon (req, res, next) { |
|
|
async postUpdateSiteIcon (req, res) { |
|
|
const { image: imageService } = this.dtp.services; |
|
|
const { image: imageService } = this.dtp.services; |
|
|
try { |
|
|
try { |
|
|
res.locals.image = await imageService.updateSiteIcon(req.body, req.file); |
|
|
const displayList = this.createDisplayList('site-icon'); |
|
|
|
|
|
await imageService.updateSiteIcon(req.body, req.file); |
|
|
|
|
|
displayList.showNotification( |
|
|
|
|
|
'Site Icon updated successfully.', |
|
|
|
|
|
'success', |
|
|
|
|
|
'bottom-center', |
|
|
|
|
|
2000, |
|
|
|
|
|
); |
|
|
res.status(200).json({ |
|
|
res.status(200).json({ |
|
|
success: true, |
|
|
success: true, |
|
|
imageId: res.locals.image.toString(), |
|
|
displayList, |
|
|
}); |
|
|
}); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
this.log.error('failed to create image', { error }); |
|
|
this.log.error('failed to update site icon', { error }); |
|
|
return next(error); |
|
|
return res.status(error.statusCode || 500).json({ |
|
|
|
|
|
success: false, |
|
|
|
|
|
message: error.message, |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|