{"size": 651, "ext": "js", "max_stars_repo_path": "webapp/src/services/SearchService.js", "max_stars_repo_name": "muuhoffman/diagnosis-search", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webapp/src/services/SearchService.js", "max_issues_repo_name": "muuhoffman/diagnosis-search", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "webapp/src/services/SearchService.js", "max_forks_repo_name": "muuhoffman/diagnosis-search", "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": 24.1111111111, "max_line_length": 61, "alphanum_fraction": 0.5192012289}
import axios from 'axios'

class SearchService {

    /**
     * 
     * @param {*} searchText string of search text
     * @param {*} callback closure taking an array of strings
     */
    executeSearch(searchText, callback) {
        axios.get('http://localhost:5000/api/v1/diagnosis', {
            params: {
                q: searchText
            }
        }).then(function (response) {
            var results = response.data.results.map((x) => {
                return x.name
            });
            callback(results)
        }).catch(function (error) {
            console.log(error);
        });
    }

}

export default SearchService;