{"size": 571, "ext": "js", "max_stars_repo_path": "app/actions/TrackManagerActions.js", "max_stars_repo_name": "univthink/spotify", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/actions/TrackManagerActions.js", "max_issues_repo_name": "univthink/spotify", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/actions/TrackManagerActions.js", "max_forks_repo_name": "univthink/spotify", "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": 19.6896551724, "max_line_length": 54, "alphanum_fraction": 0.6059544658}
import alt from '../alt';

class TrackManagerActions{
  constructor() {
    this.generateActions(
      'submitRankingsSuccess',
      'submitRankingsFail',
      'rateTrack',
    );
  }

  submitRankings(tracks) {
    $.ajax({
      type: 'POST',
      url: '/api/tracks',
      contentType: 'application/json',
      data: JSON.stringify(tracks)
    })
    .done((data) => {
      this.actions.submitRankingsSuccess(data);
    })
    .fail((jqXhr) => {
      this.actions.submitRankingsFail(jqXhr);
    });
  }
}

export default alt.createActions(TrackManagerActions);
