<commit_before>import { push } from 'react-router-redux';
import { GET_RECENT_POSTS, GET_POST_BY_SLUG } from '../actions';
import 'whatwg-fetch';

export function updateURL(page) {
  return (dispatch) => {
    if (page === 1) {
      dispatch(push('/blog'));
    } else {
      dispatch(push(`/blog?page=${page}`));
    }
  };
}

export function getRecentPost(page) {
  return (dispatch) => {
    dispatch({
      type: GET_RECENT_POSTS,
      payload: null
    });

    fetch(`${BLOG_API_ENDPOINT}/api/get_recent_posts/?page=${page}`, {
      method: 'GET'
    }).then((response) => response.json()).then((posts) => {
      dispatch(updateURL(page));
      dispatch({
        type: GET_RECENT_POSTS,
        payload: posts<commit_msg>fix redirect after blogposts loading<commit_after>import { push } from 'react-router-redux';
import { GET_RECENT_POSTS, GET_POST_BY_SLUG } from '../actions';
import 'whatwg-fetch';

export function updateURL(page) {
  return (dispatch) => {
    if (page === 1) {
      dispatch(push('/blog'));
    } else {
      dispatch(push(`/blog?page=${page}`));
    }
  };
}

export function getRecentPost(page) {
  return (dispatch) => {
    dispatch({
      type: GET_RECENT_POSTS,
      payload: null
    });

    dispatch(updateURL(page));

    fetch(`${BLOG_API_ENDPOINT}/api/get_recent_posts/?page=${page}`, {
      method: 'GET'
    }).then((response) => response.json()).then((posts) => {
      dispatch({
        type: GET_RECENT_POSTS,
        payload: posts
{'fraction_non_alphanumeric': 0.17158176943699732, 'fraction_numerical': 0.0013404825737265416, 'mean_word_length': 3.2657142857142856, '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': '2190262', 'n_tokens_mistral': 499, 'n_tokens_neox': 487, 'n_words': 89}