'use strict'; import { RouteRequest } from '@peace/utils'; import { RouteTable } from '$utils' import io from 'socket.io-client'; export const INIT_LAYOUT = 'INIT_LAYOUT'; export function initLayout (title, copyright, sections, actions) { return { type: INIT_LAYOUT, payload: { title, copyright, sections, actions } }; } export const RESIZE = 'RESIZE'; export function resize (clientHeight, clientWidth) { const headerHeight = 60 const footerHeight = 0 return { type: RESIZE, payload: { clientHeight: clientHeight - headerHeight - footerHeight, clientWidth: clientWidth } } } export const INIT_API_ROOT = 'INIT_API_ROOT'; export function initApiRoot () { return dispatch => { RouteRequest.get(RouteTable.apiRoot).then(res => { localStorage.setItem('apiRoot', res.root); // const socket = io('ws://127.0.0.1:4000', () => { }); dispatch({ type: INIT_API_ROOT, payload: { apiRoot: res.root } }) }); } }