Update getData

This commit is contained in:
Sosthene 2025-06-15 10:35:24 +02:00
parent 32b5f697c5
commit 32d76e2328

View File

@ -264,8 +264,8 @@ export default class MessageBus {
}); });
} }
public getData(processId: string, stateId: string): Promise<any> { public getData(processId: string, stateId: string): Promise<Record<string, any>> {
return new Promise<any>((resolve: (data: any) => void, reject: (error: string) => void) => { return new Promise<Record<string, any>>((resolve: (data: Record<string, any>) => void, reject: (error: string) => void) => {
this.checkToken().then(() => { this.checkToken().then(() => {
const userStore = UserStore.getInstance(); const userStore = UserStore.getInstance();
const accessToken = userStore.getAccessToken()!; const accessToken = userStore.getAccessToken()!;
@ -273,7 +273,7 @@ export default class MessageBus {
const correlationId = uuidv4(); const correlationId = uuidv4();
this.initMessageListener(correlationId); this.initMessageListener(correlationId);
const unsubscribe = EventBus.getInstance().on('DATA_RETRIEVED', (responseId: string, data: any) => { const unsubscribe = EventBus.getInstance().on('DATA_RETRIEVED', (responseId: string, data: Record<string, any>) => {
if (responseId !== correlationId) { if (responseId !== correlationId) {
return; return;
} }
@ -295,7 +295,7 @@ export default class MessageBus {
type: 'RETRIEVE_DATA', type: 'RETRIEVE_DATA',
processId, processId,
stateId, stateId,
token: accessToken accessToken
}); });
}).catch(console.error); }).catch(console.error);
}); });