<commit_before>import 'whatwg-fetch';
import {
  WIDGET_FETCH_ERROR,
  WIDGET_DETAIL_RECEIVED
} from '../constants';


export function getWidgetBySlug(slug) {
  return dispatch => {
    fetch(`${config.apiUrl}/api/widget/${slug}`)
      .then(response => {
        if (response.ok) return response.json();
        throw new Error(response.statusText);
      })
      .then(data => {
        dispatch({
          type: WIDGET_DETAIL_RECEIVED,
          payload: { data }
        });
      })
      .catch((err) => {
        dispatch({
          type: WIDGET_FETCH_ERROR,
          payload: err.message
        });
      });
  };
}<commit_msg>fixing widget api path<commit_after>import 'whatwg-fetch';
import {
  WIDGET_FETCH_ERROR,
  WIDGET_DETAIL_RECEIVED
} from '../constants';


export function getWidgetBySlug(slug) {
  return dispatch => {
    fetch(`${config.apiUrl}/api/widgets/${slug}`)
      .then(response => {
        if (response.ok) return response.json();
        throw new Error(response.statusText);
      })
      .then(data => {
        dispatch({
          type: WIDGET_DETAIL_RECEIVED,
          payload: { data }
        });
      })
      .catch((err) => {
        dispatch({
          type: WIDGET_FETCH_ERROR,
          payload: err.message
        });
      });
  };
}
{'fraction_non_alphanumeric': 0.14396284829721362, 'fraction_numerical': 0.0, 'mean_word_length': 2.1231884057971016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3602682', 'n_tokens_mistral': 426, 'n_tokens_neox': 419, 'n_words': 69}