ignore password
This commit is contained in:
parent
022a7a9733
commit
b869b83a3f
|
|
@ -35,10 +35,6 @@ export default function WorkingPage({ data, socket }: IWorkingPageProps) {
|
||||||
};
|
};
|
||||||
}, [socket, data.id, data.type]);
|
}, [socket, data.id, data.type]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log({ imageSrc });
|
|
||||||
}, [imageSrc]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box className="rounded-md overflow-hidden relative shadow-lg">
|
<Box className="rounded-md overflow-hidden relative shadow-lg">
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,7 @@ export default function DashBoard() {
|
||||||
console.log('❌ WebSocket disconnected');
|
console.log('❌ WebSocket disconnected');
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('bidsUpdated', (data: IWebBid[]) => {
|
socket.on('adminBidsUpdated', (data: IWebBid[]) => {
|
||||||
console.log('📢 Bids Data:', data);
|
|
||||||
|
|
||||||
const array = data.reduce((prev, cur) => {
|
const array = data.reduce((prev, cur) => {
|
||||||
if (cur.children?.length > 0) {
|
if (cur.children?.length > 0) {
|
||||||
prev = [...prev, ...cur.children];
|
prev = [...prev, ...cur.children];
|
||||||
|
|
@ -56,7 +54,7 @@ export default function DashBoard() {
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log('🔌 Cleanup WebSocket listeners...');
|
console.log('🔌 Cleanup WebSocket listeners...');
|
||||||
socket.off('bidsUpdated');
|
socket.off('adminBidsUpdated');
|
||||||
socket.off('working');
|
socket.off('working');
|
||||||
socket.off('connect');
|
socket.off('connect');
|
||||||
socket.off('disconnect');
|
socket.off('disconnect');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { Timestamp } from './timestamp';
|
import { Timestamp } from './timestamp';
|
||||||
import { Bid } from './bid.entity';
|
import { Bid } from './bid.entity';
|
||||||
|
import { Exclude } from 'class-transformer';
|
||||||
|
|
||||||
@Entity('web_bids')
|
@Entity('web_bids')
|
||||||
export class WebBid extends Timestamp {
|
export class WebBid extends Timestamp {
|
||||||
|
|
@ -17,6 +18,7 @@ export class WebBid extends Timestamp {
|
||||||
username: string;
|
username: string;
|
||||||
|
|
||||||
@Column({ default: null, nullable: true })
|
@Column({ default: null, nullable: true })
|
||||||
|
@Exclude()
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
@Column({ default: true })
|
@Column({ default: true })
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import { Server, Socket } from 'socket.io';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import { BidsService } from '../services/bids.service';
|
import { BidsService } from '../services/bids.service';
|
||||||
import { WebBidsService } from '../services/web-bids.service';
|
import { WebBidsService } from '../services/web-bids.service';
|
||||||
|
import { plainToClass } from 'class-transformer';
|
||||||
|
import { WebBid } from '../entities/wed-bid.entity';
|
||||||
|
|
||||||
@WebSocketGateway({
|
@WebSocketGateway({
|
||||||
cors: {
|
cors: {
|
||||||
|
|
@ -29,6 +31,7 @@ export class BidGateway implements OnGatewayConnection {
|
||||||
async onModuleInit() {
|
async onModuleInit() {
|
||||||
this.eventEmitter.on('bids.updated', (data) => {
|
this.eventEmitter.on('bids.updated', (data) => {
|
||||||
this.server.emit('bidsUpdated', data);
|
this.server.emit('bidsUpdated', data);
|
||||||
|
this.server.emit('adminBidsUpdated', plainToClass(WebBid, data));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.eventEmitter.on('web.updated', (data) => {
|
this.eventEmitter.on('web.updated', (data) => {
|
||||||
|
|
@ -46,5 +49,6 @@ export class BidGateway implements OnGatewayConnection {
|
||||||
const data = await this.webBidsService.getDataClient();
|
const data = await this.webBidsService.getDataClient();
|
||||||
// Gửi dữ liệu bids ngay khi client kết nối
|
// Gửi dữ liệu bids ngay khi client kết nối
|
||||||
client.emit('bidsUpdated', data);
|
client.emit('bidsUpdated', data);
|
||||||
|
client.emit('adminBidsUpdated', plainToClass(WebBid, data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue