fix returning response

This commit is contained in:
austinkelsay 2024-11-08 14:08:06 -06:00
parent 4a5e427b26
commit 393623c4c0
No known key found for this signature in database
GPG Key ID: 44CB4EC6D9F2FA02

View File

@ -78,18 +78,16 @@ export default async function handler(req, res) {
settled: false
}, { ex: expiry || 86400 });
// Trigger the polling endpoint
try {
await axios.get(`${BACKEND_URL}/api/invoices/short-poll`, {
// Trigger the polling endpoint without waiting for it
fetch(`${BACKEND_URL}/api/invoices/short-poll`, {
headers: {
'Authorization': PLEBDEVS_API_KEY
}
});
} catch (error) {
}).catch(error => {
console.error('Error triggering polling:', error);
// Continue even if polling fails
}
});
// Return response immediately
res.status(200).json({
invoice,
payment_hash: paymentHashHex,