<commit_before>import { EDIT_WIDGET, FETCH_WIDGETS } from '../constants/ActionTypes'
import $ from 'jquery'

const BASE_URL = process.env.BASE_URL

export function editWidget(params) {
  return dispatch => {
    $.ajax(`${BASE_URL}/mobilizations/${params.mobilization_id}/widgets/${params.widget_id}`, {
      method: 'put',
      data: { widget: params.widget },
      success: function(data, textStatus, jqXHR){
        dispatch({
          type: EDIT_WIDGET,
          widgets: data
        })
      }
    })
  }
}

export function fetchWidgets(params) {
  return dispatch => {
    $.ajax(`${BASE_URL}/mobilizations/${params.mobilization_id}/widgets`, {
      success: function(data, textStatus, jqXHR){
        dispatch({
          type: FETCH_WIDGETS,
          widgets: data
        })
      }
    })
  }
}
<commit_msg>[#98297792] fix edit widget action<commit_after>import { EDIT_WIDGET, FETCH_WIDGETS } from '../constants/ActionTypes'
import $ from 'jquery'

const BASE_URL = process.env.BASE_URL

export function editWidget(params) {
  return dispatch => {
    $.ajax(`${BASE_URL}/mobilizations/${params.mobilization_id}/widgets/${params.widget_id}`, {
      method: 'put',
      data: { widget: params.widget },
      success: function(data, textStatus, jqXHR){
        dispatch({
          type: EDIT_WIDGET,
          widget: data
        })
      }
    })
  }
}

export function fetchWidgets(params) {
  return dispatch => {
    $.ajax(`${BASE_URL}/mobilizations/${params.mobilization_id}/widgets`, {
      success: function(data, textStatus, jqXHR){
        dispatch({
          type: FETCH_WIDGETS,
          widgets: data
        })
      }
    })
  }
}

{'fraction_non_alphanumeric': 0.13952095808383233, 'fraction_numerical': 0.004790419161676647, 'mean_word_length': 2.6887417218543046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '231303', 'n_tokens_mistral': 542, 'n_tokens_neox': 541, 'n_words': 96}