update
This commit is contained in:
parent
b1e34be9ce
commit
022a7a9733
|
|
@ -15,29 +15,29 @@ export class GrayApiBid extends ApiBid {
|
||||||
|
|
||||||
async polling(page) {
|
async polling(page) {
|
||||||
try {
|
try {
|
||||||
// 🔥 Xóa tất cả event chặn request trước khi thêm mới
|
// // 🔥 Xóa tất cả event chặn request trước khi thêm mới
|
||||||
page.removeAllListeners('request');
|
// page.removeAllListeners('request');
|
||||||
await page.setRequestInterception(true);
|
// await page.setRequestInterception(true);
|
||||||
|
|
||||||
page.on('request', (request) => {
|
// page.on('request', (request) => {
|
||||||
if (request.url().includes('api/Notifications/GetOutBidLots')) {
|
// if (request.url().includes('api/Notifications/GetOutBidLots')) {
|
||||||
console.log('🚀 Fake response cho request:', request.url());
|
// console.log('🚀 Fake response cho request:', request.url());
|
||||||
|
|
||||||
const fakeData = fs.readFileSync('./data/fake-out-lots.json', 'utf8');
|
// const fakeData = fs.readFileSync('./data/fake-out-lots.json', 'utf8');
|
||||||
|
|
||||||
request.respond({
|
// request.respond({
|
||||||
status: 200,
|
// status: 200,
|
||||||
contentType: 'application/json',
|
// contentType: 'application/json',
|
||||||
body: fakeData,
|
// body: fakeData,
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
try {
|
// try {
|
||||||
request.continue(); // ⚠️ Chỉ tiếp tục nếu request chưa bị chặn
|
// request.continue(); // ⚠️ Chỉ tiếp tục nếu request chưa bị chặn
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error('⚠️ Lỗi khi tiếp tục request:', error.message);
|
// console.error('⚠️ Lỗi khi tiếp tục request:', error.message);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
console.log('🔄 Starting polling process...');
|
console.log('🔄 Starting polling process...');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue