1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-19 11:39:36 +02:00

Fixed bug with custom icons not working with apps

This commit is contained in:
Paweł Malak 2021-11-18 13:05:32 +01:00
parent 1220c56fc5
commit 426766225b
7 changed files with 31 additions and 39 deletions

View file

@ -8,25 +8,20 @@ const loadConfig = require('../../utils/loadConfig');
const createApp = asyncWrapper(async (req, res, next) => {
const { pinAppsByDefault } = await loadConfig();
let app;
let _body = { ...req.body };
let body = { ...req.body };
if (_body.icon) {
_body.icon = _body.icon.trim();
if (body.icon) {
body.icon = body.icon.trim();
}
if (req.file) {
_body.icon = req.file.filename;
body.icon = req.file.filename;
}
if (pinAppsByDefault) {
app = await App.create({
..._body,
isPinned: true,
});
} else {
app = await App.create(req.body);
}
const app = await App.create({
...body,
isPinned: pinAppsByDefault,
});
res.status(201).json({
success: true,