Skip to content

Commit

Permalink
feat: add delay for sending notification for test
Browse files Browse the repository at this point in the history
  • Loading branch information
serezhaolshan committed Oct 8, 2024
1 parent 0b01159 commit cc45624
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/router/watcher.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@ const routes = (app: Application, container: DependencyContainer) => {

app.post("/api/v1/send-notification", (req, res) => {
const { title, body, pushToken, data } = req.body;
container.resolve(NotificationService).sendNotification({
title,
body,
pushToken,
data
}).then((result) => {
res.send(result);
}).catch((error) => {
res.status(500).send(error);
});
setTimeout(() => {
container.resolve(NotificationService).sendNotification({
title,
body,
pushToken,
data
}).then((result) => {
res.send(result);
}).catch((error) => {
res.status(500).send(error);
});
}, 5000);
});
};
export default routes;

0 comments on commit cc45624

Please sign in to comment.