{"version":3,"sources":["webpack:///./src/containers/Live.jsx"],"names":["Live","dispatch","useDispatch","useEffect","ws","connect","then","on","obj","jobj","JSON","parse","type","wsTypes","message","payload","user","id","auth","getUserId","wsOnNewPost","messageBoard","parent","wsOnNotification"],"mappings":"2FAAA,2GA+CeA,UAjCF,WACT,IAAMC,EAAWC,cA4BjB,OA1BAC,qBAAU,WACNC,IAAGC,UAAUC,MAAK,WAEdF,IAAGG,GAAG,UAAU,SAACC,GACb,IAAMC,EAAOC,KAAKC,MAAMH,GACxBP,EAAS,CAAEW,KAAOC,IAAoBC,QAAUL,EAAKK,QAASC,QAAUN,EAAKM,aAIjFX,IAAGG,GAAG,eAAe,SAACC,GACdA,EAAIQ,KAAKC,KAAOC,IAAKC,aACrBlB,EAASmB,YAAYZ,EAAIa,aAAaJ,GAAIT,EAAIc,QAAUd,EAAIc,OAAOL,GAAIT,OAI/EJ,IAAGG,GAAG,gBAAgB,SAACC,GACnBP,EAASsB,YAAiBf,YAOnC,IAGI","file":"7.a904351f97cc0c52a012.js","sourcesContent":["import React, { useEffect } from 'react'\r\n\r\nimport { useDispatch } from 'react-redux'\r\n\r\nimport { wsOnNewPost } from '../redux/messageBoard/actions'\r\nimport { wsOnNotification } from '../redux/notification/actions'\r\n\r\nimport ws from '../common/WebSocketClient'\r\nimport * as wsTypes from '../redux/ws/types'\r\nimport * as matchTypes from '../redux/match/types'\r\n\r\nimport auth from '../common/auth'\r\n\r\n\r\nconst Live = () => {\r\n const dispatch = useDispatch();\r\n\r\n useEffect(() => {\r\n ws.connect().then(() => {\r\n \r\n ws.on('update', (obj) => { \r\n const jobj = JSON.parse(obj);\r\n dispatch({ type : wsTypes.WS_MESSAGE, message : jobj.message, payload : jobj.payload });\r\n\r\n });\r\n\r\n ws.on('PostCreated', (obj) => {\r\n if (obj.user.id !== auth.getUserId()) {\r\n dispatch(wsOnNewPost(obj.messageBoard.id, obj.parent && obj.parent.id, obj));\r\n }\r\n });\r\n\r\n ws.on('Notification', (obj) => {\r\n dispatch(wsOnNotification(obj));\r\n });\r\n\r\n })\r\n\r\n\r\n \r\n }, []);\r\n\r\n\r\n return null;\r\n}\r\n\r\n\r\nexport default Live;\r\n\r\n"],"sourceRoot":""}