import io from 'socket.io-client';
import { API_BASE_URI, STATION_URI } from '../constants';

export const RECEIVE_QUERIES = 'RECEIVE_QUERIES';
export const LISTEN_FOR_QUERIES = 'LISTEN_FOR_QUERIES';

export const receiveQueries = (queries) => ({
  type: RECEIVE_QUERIES,
  payload: queries
});

export const listenToQueries = () => (
  dispatch => {
    const socket = io(API_BASE_URI);
    // socket.emit('fetchLogs', { stop: STATION_URI});
    socket.on(STATION_URI, function(queries) {
      dispatch(receiveQueries(queries));
    });
  }
);

@@ -58,20 +58,16 @@
  STATION
-_URI
  %7D from 
@@ -424,17 +424,17 @@
  STATION
-_
+.
 URI%7D);%0A 
@@ -457,22 +457,14 @@
 TION
-_
+.
 URI, 
-function
 (que
@@ -468,16 +468,19 @@
 queries)
+ =%3E
  %7B%0A     

fix bug