formData: {
file: Buffer.from(image, 'base64')
}
var getUser = function (userId) {
return new Promise((resolve, reject) => {
User.findOne({ _id: userId }).exec(function (err, user) {
if (err) return reject(err);
return resolve(user);
});
})
};
async function edit() {
let user;
if (user.locale == 'en') {
user = await getUser();
} else {
user = await getUser();
}
return { title, body, sound: 'obyjvlenie.mp3' }
}
async function edit() {
let title; body;
if (user.locale == 'en') {
[title, body] = await Promise.all([
getEnTitle(),
getEnBody()
]);
} else {
[title, body] = await Promise.all([
getRuTitle(),
getRuBody()
]);
}
return { title, body, sound: 'obyjvlenie.mp3' }
}