<commit_before>'use strict'

var Request = require('superagent');

module.exports = {
	create(patientId, menu) {
		return new Promise(function(resolve, reject) {
			Request
				.post(`http://localhost:3030/api/patient/${patientId}/menu`)
				.send(menu)
				.end((err, res) => {
					if (res.ok) {
						resolve();
					} else {
						reject(res.text);
					}
				});
		});
	},
	getById(patientId, menuId) {
		return new Promise(function(resolve, reject) {
			Request
				.get(`http://localhost:3030/api/patient/${patientId}/menu/${menuId}`)
				.end((err, res) => {
					if (res.ok) {
						resolve(res.body);
					} else {
						reject(res.text);
					}
				});
		});
	}
}<commit_msg>Refactor of menuService<commit_after>'use strict';

const menuService = {
    create (patientId, menu) {
        return fetch(`http://localhost:3030/api/patient/${patientId}/menu`, {
            body: JSON.stringify(menu),
            headers: {
                'Content-Type': 'application/json'
            },
            method: 'post'
        });
    },
    getById (patientId, menuId) {
        return fetch(`http://localhost:3030/api/patient/${patientId}/menu/${menuId}`, {
            method: 'get'
        }).then((response) => {
            return response.json();
        });
    }
};

export default menuService;
{'fraction_non_alphanumeric': 0.17647058823529413, 'fraction_numerical': 0.012223071046600458, 'mean_word_length': 2.291457286432161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2096788', 'n_tokens_mistral': 495, 'n_tokens_neox': 417, 'n_words': 68}