Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.

Commit e3bb942

Browse files
committed
Update app.js
1 parent b2e96d1 commit e3bb942

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ const auth = new google.auth.GoogleAuth({
2121
});
2222

2323
// ฟังชั่นหลัก
24-
app.post('/webhook', line.middleware(lineConfig), async (req, res) => {
24+
app.post('/webhook', line.middleware(lineConfig), async (req, res, next) => {
2525
try {
2626
const events = req.body.events
2727
console.log('event', events)
28+
29+
if (req.session.user) return next();
30+
next(new NotAuthorizedError());
2831
return events.length > 0 ? await events.map(item => handleEvent(item)) : res.status(200).send("OK")
2932
} catch (e) {
3033
res.status(500).end()

0 commit comments

Comments
 (0)