Catch error from sending notification api

This commit is contained in:
Hongbo Wu
2022-11-22 12:51:59 +08:00
parent 2ae3226bdb
commit 1ef862782f
2 changed files with 10 additions and 7 deletions

View File

@ -24,7 +24,6 @@
"@sentry/serverless": "^6.16.1",
"axios": "^0.27.2",
"dotenv": "^16.0.1",
"firebase-admin": "^10.0.2",
"jsonwebtoken": "^8.5.1",
"search-query-parser": "^1.6.0"
}

View File

@ -26,10 +26,14 @@ export const sendNotification = async (
notificationType: 'rule',
}
await axios.post(`${apiEndpoint}/notification/send`, data, {
headers: {
Cookie: `auth=${auth};`,
'Content-Type': 'application/json',
},
})
try {
await axios.post(`${apiEndpoint}/notification/send`, data, {
headers: {
Cookie: `auth=${auth};`,
'Content-Type': 'application/json',
},
})
} catch (e) {
console.error(e)
}
}