Skip to content

Commit

Permalink
Fix incorrect usage of array.concat
Browse files Browse the repository at this point in the history
It doesn't work in-place.
  • Loading branch information
lovett committed May 2, 2019
1 parent 3c2b456 commit 7cf44b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/routes/clear.ts
Expand Up @@ -11,10 +11,10 @@ const router = PromiseRouter();
* Messages are specified by their public id or local id.
*/
router.post('/', async (req: Request, res: Response, next: NextFunction) => {
const messageIds: string[] = [];
let messageIds: string[] = [];

if (req.body.hasOwnProperty('publicId')) {
messageIds.push(req.body.publicId);
messageIds = messageIds.concat(req.body.publicId);
}

if (req.body.hasOwnProperty('localId')) {
Expand All @@ -23,7 +23,7 @@ router.post('/', async (req: Request, res: Response, next: NextFunction) => {
req.user,
req.body.localId,
);
messageIds.concat(ids);
messageIds = messageIds.concat(ids);
} catch (e) {
res.status(500);
return next(e);
Expand Down

0 comments on commit 7cf44b1

Please sign in to comment.