<commit_before>import config from '../config'

export interface Terms {
    [id: number]: string
}

export interface SetTermAction extends Redux.Action {
    terms: Terms
}

interface TermDB {"Term_ID":number,"Term": string}

export function fetchTerms(): Promise<Terms>{
    return fetch(config.api+"/class_view")
    .then(response => response.json())
    .then(json => json as TermDB[])
    .then(terms => terms.reduce<Terms>((terms, t) => {terms[t.Term_ID] = t.Term; return  terms}, {}))
}<commit_msg>Actually Fetch Terms Properly<commit_after>import config from '../config'

export interface Terms {
    [id: number]: string
}

export interface SetTermAction extends Redux.Action {
    terms: Terms
}

interface TermDB {"Term_ID":number,"Term": string}

export function fetchTerms(): Promise<Terms>{
    return fetch(config.api+"/term_view")
    .then(response => response.json())
    .then(json => json as TermDB[])
    .then(terms => terms.reduce<Terms>((terms, t) => {terms[t.Term_ID] = t.Term; return  terms}, {}))
}
{'fraction_non_alphanumeric': 0.16, 'fraction_numerical': 0.0, 'mean_word_length': 4.457446808510638, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 15, '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': '878976', 'n_tokens_mistral': 330, 'n_tokens_neox': 321, 'n_words': 83}