소스 검색

Fixed issue with socket dispatches that didn't provide a callback

Kristian Vos 4 년 전
부모
커밋
2b2820f325
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      frontend/src/ws.js

+ 8 - 4
frontend/src/ws.js

@@ -97,11 +97,15 @@ export default {
 					return onConnect.temp.push(() => this.dispatch(...args));
 
 				const cb = args[args.length - 1];
-				if (typeof cb === "function") CB_REFS[CB_REF] = cb;
+				if (typeof cb === "function") {
+					CB_REFS[CB_REF] = cb;
 
-				return this.send(
-					JSON.stringify([...args.slice(0, -1), { CB_REF }])
-				);
+					return this.send(
+						JSON.stringify([...args.slice(0, -1), { CB_REF }])
+					);
+				}
+
+				return this.send(JSON.stringify([...args]));
 			}
 		}