<commit_before>/**
 * 
 * Action creator untuk menngambil data image dari api, yang mereturn sebuah
 * promise dengan bantuan 'redux-promise-middleware' dan 'redux-thunk'
 * 
 */

import axios from "axios"
import { FETCH_IMAGES } from "./actionTypes"
import { ORCINUS_OMURA } from "../config/environtment"
import _ from "lodash"

import { setNewService } from "./serviceActions"

export function fetchCatalog() {
	return {
		type: "FETCH_CATALOG",
		payload: axios.get(`http://${ ORCINUS_OMURA }/apis`)
	}
}

export function removeItemFromBoard(name) {
	return {
		type: "REMOVE_ITEM_FROM_BOARD",
		name
	}
}

/**
 * Async Action Creator for adding item to board
 */
export function fetchCatalogItem(name, category) {
	const request = axios({
		method: 'get',
		url: `http://${ ORCINUS_OMURA }/apis/${ category }/${ name }`
	})

	return {<commit_msg>UPDATE: add api host checking on catalog<commit_after>/**
 * 
 * Action creator untuk menngambil data image dari api, yang mereturn sebuah
 * promise dengan bantuan 'redux-promise-middleware' dan 'redux-thunk'
 * 
 */

import axios from "axios"
import { FETCH_IMAGES } from "./actionTypes"
import { ORCINUS_OMURA } from "../config/environtment"
import _ from "lodash"

import { setNewService } from "./serviceActions"

const ROOT_URL = location.href.indexOf('localhost') > 0 ? `http://localhost:8080/apis` : '/apis'

export function fetchCatalog() {
	return {
		type: "FETCH_CATALOG",
		payload: axios.get(`${ ROOT_URL }`)
	}
}

export function removeItemFromBoard(name) {
	return {
		type: "REMOVE_ITEM_FROM_BOARD",
		name
	}
}

/**
 * Async Action Creator for adding item to board
 */
export function fetchCatalogItem(name, category) {
	const request = axios({
		method: 'get',
		url: `${ ROOT_URL }/${ category }/${ name }`
	})

	return {
{'fraction_non_alphanumeric': 0.135678391959799, 'fraction_numerical': 0.0027917364600781687, 'mean_word_length': 4.179190751445087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6698864', 'n_tokens_mistral': 651, 'n_tokens_neox': 625, 'n_words': 165}