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:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user