build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / ui / web / src / composables / UIClient.ts
index 841ec3dca8c42510c3ce504c05dbe42c45773adc..387d73d27529bfaf91e25f068bd9612ce53fb33c 100644 (file)
@@ -144,15 +144,13 @@ export class UIClient {
     command: ProcedureName,
     data: RequestPayload,
   ): Promise<ResponsePayload> {
-    let uuid: string;
-    return await new Promise<ResponsePayload>((resolve, reject) => {
-      uuid = crypto.randomUUID();
-      const msg = JSON.stringify([uuid, command, data]);
-
+    return new Promise<ResponsePayload>((resolve, reject) => {
       if (this.ws.readyState !== WebSocket.OPEN) {
         this.openWS();
       }
       if (this.ws.readyState === WebSocket.OPEN) {
+        const uuid = crypto.randomUUID();
+        const msg = JSON.stringify([uuid, command, data]);
         const sendTimeout = setTimeout(() => {
           this.deleteResponseHandler(uuid);
           return reject(new Error(`Send request '${command}' message timeout`));