<commit_before>const DB_DEBTS = 'http://nuwn.net/schoolapi/debt.php';  //url to db

// function for getting all debts from db
export function getDebts() {
    const url = `${DB_DEBTS}?all`;

    return fetch(url, {
    })
        .then(response => response.json());
}

// function for posting one debt to db
export function postDebt(vad ,obj) {

    //set url
    const url = `${DB_DEBTS}?insert`;

    // format obj to be able to send to db
    var data = new FormData();
    data.append("json", JSON.stringify( obj ));

    return fetch(url, {
        method: "POST",
        header: {
            'Content-Type': 'x-www-form-urlencoded'
        },
        body: data
    })
    .then(response => response.json());
}

// function for updating one debt to db
export function destroyDebt(obj) {

    //set url
    const url = `${DB_DEBTS}?remove`;

    // format obj to be able to send to db
    var data = new FormData();
    data.append("json", JSON.stringify( obj ));

    return fetch(url, {
        method: "POST",
        header: {
            'Content-Type': 'x-www-form-urlencoded'
        },
        body: data
    })
    .then(response => response.json());
}<commit_msg>api db<commit_after>const DB_DEBTS = 'http://nuwn.net/schoolapi/debt.php'; // url to db
const URL_BORROWERS = `http://nuwn.net/schoolapi/borrower.php`; // url to borrowers
const URL_DEBTGIVERS = `http://nuwn.net/schoolapi/debtGivers.php`; // utl to debtgivers

// function for getting all debts from db
export function getDebts() {
    const url = `${DB_DEBTS}?all`;

    return fetch(url, {
    })
        .then(response => response.json());
}

// function for posting one debt to db
export function postDebt(obj) {

    //set url
    const url = `${DB_DEBTS}?insert`;

    // format obj to be able to send to db
    var data = new FormData();
    data.append("json", JSON.stringify( obj ));

    return fetch(url, {
        method: "POST",
        header: {
            'Content-Type': 'x-www-form-urlencoded'
        },
        body: data
    })
    .then(response => response.json());
}

// function for updating one debt to db
export function destroyDebt(obj) {

    //set url
    const url = `${DB_DEBTS}?remove`;

    // format obj to be able to send to db
    var data = new FormData();
    data.append("json", JSON.stringify( obj ));

    return fetch(url, {
        method: "POST",
        header: {
            'Content-Type': 'x-www-form-urlencoded'
        },
        body: data
    })
    .then(response => response.json());
}

// function for getting borrowers from db
export function getBorrowers() {
    return fetch(URL_BORROWERS, {
        })
            .then(response => response.json());
}

// function for getting debtGivers from db
export function getDebtGivers() {
    return fetch(URL_DEBTGIVERS, {
    })
        .then(response => response.json());
}
{'fraction_non_alphanumeric': 0.143857192859643, 'fraction_numerical': 0.0, 'mean_word_length': 2.382248520710059, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5673196', 'n_tokens_mistral': 934, 'n_tokens_neox': 906, 'n_words': 254}