Feature: Improve RxStompConfig and book card menu permissions

• Utilize beforeConnect in RxStompConfig to ensure token retrieval at connection time.
• Dynamically generate the book card menu based on user permissions instead of hiding items.
This commit is contained in:
aditya.chandel
2025-02-17 01:27:09 -07:00
parent 4a76c1e12f
commit 377c6ef628
2 changed files with 66 additions and 52 deletions
@@ -1,16 +1,16 @@
import { RxStompConfig } from '@stomp/rx-stomp';
import { API_CONFIG } from '../../config/api-config';
import {RxStompConfig} from '@stomp/rx-stomp';
import {API_CONFIG} from '../../config/api-config';
import {AuthService} from '../../core/service/auth.service';
export function createRxStompConfig(authService: AuthService): RxStompConfig {
return {
brokerURL: API_CONFIG.BROKER_URL,
connectHeaders: {
Authorization: `Bearer ${authService.getToken()}`,
},
heartbeatIncoming: 0,
heartbeatOutgoing: 20000,
reconnectDelay: 200,
beforeConnect: (stomp) => {
stomp.stompClient.connectHeaders = {'Authorization': `Bearer ${authService.getToken()}`};
},
debug: (msg: string): void => {
//console.log(new Date(), msg);
},