{"size": 1589, "ext": "js", "max_stars_repo_path": "src/admin/actions/trans-action.js", "max_stars_repo_name": "Rooiean/tradlinxstudy", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/admin/actions/trans-action.js", "max_issues_repo_name": "Rooiean/tradlinxstudy", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/admin/actions/trans-action.js", "max_forks_repo_name": "Rooiean/tradlinxstudy", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 46.7352941176, "max_line_length": 228, "alphanum_fraction": 0.7212083071}
import _ from 'lodash';
import { createAction } from 'redux-actions';

const prefix = 'http://40.74.122.172:4567';

export const PUT_TRANSPORT = '[API] PUT_TRANSPORT';
export const POST_TRANSPORT = '[API] POST_TRANSPORT';
export const DEL_TRANSPORT = '[API] DEL_TRANSPORT';

export const __putTransport__ = createAction(PUT_TRANSPORT);
export const __postTransport__ = createAction(POST_TRANSPORT);
export const __delTransport__ =  createAction(DEL_TRANSPORT);

export const putTransport = (id, name, sourcePort, destinationPort, type, scheduleList, cycle, cost, requiredTime, status) => (dispatch) =>
  dispatch(__putTransport__({
    path: prefix + `/transports/${id}?name=${name}&sourcePort=${sourcePort}&destinationPort=${destinationPort}&type=${type}&scheduleList=${scheduleList}&cycle=${cycle}&cost=${cost}&requiredTime=${requiredTime}&status=${status}`,
    method: 'put',
    dist: 'trans', status: 'transPutStatus',
  }))

export const postTransport = (name, sourcePort, destinationPort, type, scheduleList, cycle, cost, requiredTime, status) => (dispatch) =>
  dispatch(__postTransport__({
    path: prefix + `/transports?name=${name}&sourcePort=${sourcePort}&destinationPort=${destinationPort}&type=${type}&scheduleList=${scheduleList}&cycle=${cycle}&cost=${cost}&requiredTime=${requiredTime}&status=${status}`,
    method: 'post',
    dist: 'trans', status: 'transPostStatus',
  }))

export const delTransport = (id) => (dispatch) =>
  dispatch(__delTransport__({
    path: prefix + `/transports/${id}`,
    method: 'delete',
    dist: 'trans', status: 'transDelStatus',
  }))
