Skip to content

Commit

Permalink
fix: Send file image on sendImageStorie
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jul 21, 2022
1 parent 6f02e09 commit 38c6749
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controller/statusController.js
Expand Up @@ -31,9 +31,16 @@ export async function sendTextStorie(req, res) {
export async function sendImageStorie(req, res) {
const { path, options } = req.body;

if (!path && !req.file)
return res.status(401).send({
message: 'Sending the image is mandatory',
});

const pathFile = path || req.file.path;

try {
let results = [];
results.push(await req.client.sendImageStatus(path, options));
results.push(await req.client.sendImageStatus(pathFile, options));

if (results.length === 0) return res.status(400).json('Error sending the image of stories');
returnSucess(res, results);
Expand Down

0 comments on commit 38c6749

Please sign in to comment.