Deploy to production #11
			
				
			
		
		
		
	| 
						 | 
					@ -1,13 +1,13 @@
 | 
				
			||||||
<!doctype html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="en">
 | 
					<html lang="en">
 | 
				
			||||||
  <head>
 | 
					    <head>
 | 
				
			||||||
    <meta charset="UTF-8" />
 | 
					        <meta charset="UTF-8" />
 | 
				
			||||||
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
 | 
					        <link rel="icon" href="public/favicon.ico" />
 | 
				
			||||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 | 
					        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 | 
				
			||||||
    <title>Vite + React + TS</title>
 | 
					        <title>Vite + React + TS</title>
 | 
				
			||||||
  </head>
 | 
					    </head>
 | 
				
			||||||
  <body>
 | 
					    <body>
 | 
				
			||||||
    <div id="root"></div>
 | 
					        <div id="root"></div>
 | 
				
			||||||
    <script type="module" src="/src/main.tsx"></script>
 | 
					        <script type="module" src="/src/main.tsx"></script>
 | 
				
			||||||
  </body>
 | 
					    </body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 15 KiB  | 
| 
						 | 
					@ -34,6 +34,14 @@ export default function Bids() {
 | 
				
			||||||
            title: 'Name',
 | 
					            title: 'Name',
 | 
				
			||||||
            typeFilter: 'text',
 | 
					            typeFilter: 'text',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            key: 'web_bid',
 | 
				
			||||||
 | 
					            title: 'Web',
 | 
				
			||||||
 | 
					            typeFilter: 'text',
 | 
				
			||||||
 | 
					            renderRow(row) {
 | 
				
			||||||
 | 
					                return <span>{row.web_bid.origin_url}</span>;
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            key: 'lot_id',
 | 
					            key: 'lot_id',
 | 
				
			||||||
            title: 'Lot ID',
 | 
					            title: 'Lot ID',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ export class LangtonsApiBid extends ApiBid {
 | 
				
			||||||
            const timeout = setTimeout(() => {
 | 
					            const timeout = setTimeout(() => {
 | 
				
			||||||
                global.socket.off(`verify-code.${this.origin_url}`); // Xóa listener tránh rò rỉ bộ nhớ
 | 
					                global.socket.off(`verify-code.${this.origin_url}`); // Xóa listener tránh rò rỉ bộ nhớ
 | 
				
			||||||
                rej(new Error(`[${this.id}] Timeout: No verification code received within 1 minute.`));
 | 
					                rej(new Error(`[${this.id}] Timeout: No verification code received within 1 minute.`));
 | 
				
			||||||
            }, 60 * 1000); // 60 giây
 | 
					            }, 120 * 1000); // 120 giây
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            global.socket.on(`verify-code.${this.origin_url}`, async (data) => {
 | 
					            global.socket.on(`verify-code.${this.origin_url}`, async (data) => {
 | 
				
			||||||
                console.log(`📢 [${this.id}] VERIFY CODE:`, data);
 | 
					                console.log(`📢 [${this.id}] VERIFY CODE:`, data);
 | 
				
			||||||
| 
						 | 
					@ -113,13 +113,15 @@ export class LangtonsApiBid extends ApiBid {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // ⏳ Wait for navigation after verification
 | 
					            // ⏳ Wait for navigation after verification
 | 
				
			||||||
            console.log(`⏳ [${this.id}] Waiting for navigation after verification...`);
 | 
					            console.log(`⏳ [${this.id}] Waiting for navigation after verification...`);
 | 
				
			||||||
            await page.waitForNavigation({ timeout: 8000, waitUntil: 'domcontentloaded' });
 | 
					            await page.waitForNavigation({ timeout: 15000, waitUntil: 'domcontentloaded' });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            await page.goto(this.url, { waitUntil: 'networkidle2' });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 📂 Save session context to avoid re-login
 | 
					            // 📂 Save session context to avoid re-login
 | 
				
			||||||
            await this.saveContext();
 | 
					            await this.saveContext();
 | 
				
			||||||
            console.log(`✅ [${this.id}] Login successful!`);
 | 
					            console.log(`✅ [${this.id}] Login successful!`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await page.goto(this.url);
 | 
					            // await page.goto(this.url);
 | 
				
			||||||
            console.log(`✅ [${this.id}] Navigation successful!`);
 | 
					            console.log(`✅ [${this.id}] Navigation successful!`);
 | 
				
			||||||
        } catch (error) {
 | 
					        } catch (error) {
 | 
				
			||||||
            console.error(`❌ [${this.id}] Error during login process:`, error.message);
 | 
					            console.error(`❌ [${this.id}] Error during login process:`, error.message);
 | 
				
			||||||
| 
						 | 
					@ -220,6 +222,6 @@ export class LangtonsApiBid extends ApiBid {
 | 
				
			||||||
            } catch (error) {
 | 
					            } catch (error) {
 | 
				
			||||||
                console.error(`🚨 [${this.id}] Error reloading page:`, error.message);
 | 
					                console.error(`🚨 [${this.id}] Error reloading page:`, error.message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }, 60000);
 | 
					        }, 60000); // 1p reload
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ export class LangtonsProductBid extends ProductBid {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async waitForApiResponse(timeout = 10000) {
 | 
					    async waitForApiResponse(timeout = 15000) {
 | 
				
			||||||
        if (!this.page_context) {
 | 
					        if (!this.page_context) {
 | 
				
			||||||
            console.error(`❌ [${this.id}] Error: page_context is undefined.`);
 | 
					            console.error(`❌ [${this.id}] Error: page_context is undefined.`);
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
| 
						 | 
					@ -57,9 +57,13 @@ export class LangtonsProductBid extends ProductBid {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const timer = setTimeout(() => {
 | 
					            const timer = setTimeout(async () => {
 | 
				
			||||||
                console.log(`⏳ [${this.id}] Timeout: No response received within 10s`);
 | 
					                console.log(`⏳ [${this.id}] Timeout: No response received within ${timeout / 1000}s`);
 | 
				
			||||||
                this.page_context.off('response', onResponse); // Gỡ bỏ listener khi timeout
 | 
					                this.page_context.off('response', onResponse); // Gỡ bỏ listener khi timeout
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                await this.page_context.reload({ waitUntil: 'networkidle0' }); // reload page
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                console.log(`🔁 [${this.id}] Reload page in waitForApiResponse`);
 | 
				
			||||||
                resolve(null);
 | 
					                resolve(null);
 | 
				
			||||||
            }, timeout);
 | 
					            }, timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -343,6 +347,8 @@ export class LangtonsProductBid extends ProductBid {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (!lotData || lotData.lotId !== this.lot_id) {
 | 
					                    if (!lotData || lotData.lotId !== this.lot_id) {
 | 
				
			||||||
                        console.log(`⚠️ [${this.id}] Ignored response for lotId: ${lotData?.lotId}`);
 | 
					                        console.log(`⚠️ [${this.id}] Ignored response for lotId: ${lotData?.lotId}`);
 | 
				
			||||||
 | 
					                        await this.page_context.reload({ waitUntil: 'networkidle0' });
 | 
				
			||||||
 | 
					                        console.log(`🔁 [${this.id}] Reload page in gotoLink`);
 | 
				
			||||||
                        return;
 | 
					                        return;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -364,7 +370,7 @@ export class LangtonsProductBid extends ProductBid {
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (lotData.myBid && this.max_price && this.max_price != lotData.myBid) {
 | 
					                    if (lotData.myBid && this.max_price && this.max_price != lotData.myBid) {
 | 
				
			||||||
                        this.handlePlaceBid();
 | 
					                        // this.handlePlaceBid();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (error) {
 | 
					                } catch (error) {
 | 
				
			||||||
                    console.error(`🚨 [${this.id}] Error parsing API response:`, error);
 | 
					                    console.error(`🚨 [${this.id}] Error parsing API response:`, error);
 | 
				
			||||||
| 
						 | 
					@ -393,7 +399,7 @@ export class LangtonsProductBid extends ProductBid {
 | 
				
			||||||
                await this.gotoLink();
 | 
					                await this.gotoLink();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await this.handlePlaceBid();
 | 
					            // await this.handlePlaceBid();
 | 
				
			||||||
        } catch (error) {
 | 
					        } catch (error) {
 | 
				
			||||||
            console.error(`🚨 [${this.id}] Error navigating the page: ${error}`);
 | 
					            console.error(`🚨 [${this.id}] Error navigating the page: ${error}`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,8 @@ export const createApiBid = (web) => {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const deleteProfile = (data) => {
 | 
					export const deleteProfile = (data) => {
 | 
				
			||||||
    const filePath = path.join(CONSTANTS.PROFILE_PATH, sanitizeFileName(data.origin_url) + '.json');
 | 
					    if (!data?.origin_url) return false;
 | 
				
			||||||
 | 
					    const filePath = path.join(CONSTANTS.PROFILE_PATH, sanitizeFileName(data?.origin_url) + '.json');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (fs.existsSync(filePath)) {
 | 
					    if (fs.existsSync(filePath)) {
 | 
				
			||||||
        fs.unlinkSync(filePath);
 | 
					        fs.unlinkSync(filePath);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ export const updateBid = async (id, values) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return data.data;
 | 
					        return data.data;
 | 
				
			||||||
    } catch (error) {
 | 
					    } catch (error) {
 | 
				
			||||||
        console.log('❌ ERROR IN SERVER: (UPDATE BID) ', error);
 | 
					        console.log('❌ ERROR IN SERVER: (UPDATE BID) ', error.response);
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ export const pushPrice = async (values) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return { status: true, data: data.data };
 | 
					        return { status: true, data: data.data };
 | 
				
			||||||
    } catch (error) {
 | 
					    } catch (error) {
 | 
				
			||||||
        console.log('❌ ERROR IN SERVER (PUSH PRICE): ', error.response.data);
 | 
					        console.log('❌ ERROR IN SERVER (PUSH PRICE): ', error?.response);
 | 
				
			||||||
        return { status: false, data: [] };
 | 
					        return { status: false, data: [] };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue