ignore password

This commit is contained in:
nkhangg 2025-03-19 15:36:57 +07:00
parent 022a7a9733
commit b869b83a3f
4 changed files with 8 additions and 8 deletions

View File

@ -35,10 +35,6 @@ export default function WorkingPage({ data, socket }: IWorkingPageProps) {
};
}, [socket, data.id, data.type]);
useEffect(() => {
console.log({ imageSrc });
}, [imageSrc]);
return (
<>
<Box className="rounded-md overflow-hidden relative shadow-lg">

View File

@ -27,9 +27,7 @@ export default function DashBoard() {
console.log('❌ WebSocket disconnected');
});
socket.on('bidsUpdated', (data: IWebBid[]) => {
console.log('📢 Bids Data:', data);
socket.on('adminBidsUpdated', (data: IWebBid[]) => {
const array = data.reduce((prev, cur) => {
if (cur.children?.length > 0) {
prev = [...prev, ...cur.children];
@ -56,7 +54,7 @@ export default function DashBoard() {
return () => {
console.log('🔌 Cleanup WebSocket listeners...');
socket.off('bidsUpdated');
socket.off('adminBidsUpdated');
socket.off('working');
socket.off('connect');
socket.off('disconnect');

View File

@ -1,6 +1,7 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { Timestamp } from './timestamp';
import { Bid } from './bid.entity';
import { Exclude } from 'class-transformer';
@Entity('web_bids')
export class WebBid extends Timestamp {
@ -17,6 +18,7 @@ export class WebBid extends Timestamp {
username: string;
@Column({ default: null, nullable: true })
@Exclude()
password: string;
@Column({ default: true })

View File

@ -8,6 +8,8 @@ import { Server, Socket } from 'socket.io';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { BidsService } from '../services/bids.service';
import { WebBidsService } from '../services/web-bids.service';
import { plainToClass } from 'class-transformer';
import { WebBid } from '../entities/wed-bid.entity';
@WebSocketGateway({
cors: {
@ -29,6 +31,7 @@ export class BidGateway implements OnGatewayConnection {
async onModuleInit() {
this.eventEmitter.on('bids.updated', (data) => {
this.server.emit('bidsUpdated', data);
this.server.emit('adminBidsUpdated', plainToClass(WebBid, data));
});
this.eventEmitter.on('web.updated', (data) => {
@ -46,5 +49,6 @@ export class BidGateway implements OnGatewayConnection {
const data = await this.webBidsService.getDataClient();
// Gửi dữ liệu bids ngay khi client kết nối
client.emit('bidsUpdated', data);
client.emit('adminBidsUpdated', plainToClass(WebBid, data));
}
}