1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-05 10:55:17 +02:00

Merge pull request #1 from pawelmalak/master

merge upstream
This commit is contained in:
Matthew Horwood 2021-11-23 08:13:58 +00:00 committed by GitHub
commit da22a3ada2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 499 additions and 232 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,

View file

@ -18,17 +18,17 @@ const updateApp = asyncWrapper(async (req, res, next) => {
);
}
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;
}
app = await app.update(_body);
app = await app.update(body);
res.status(200).json({
success: true,