<commit_before>import DocumentTitle from 'react-document-title';
import axios from 'axios';
import Html from './html.react';
import Promise from 'bluebird';
import React from 'react';
import Router from 'react-router';
import config from './config';
import initialState from './initialstate';
import routes from '../client/routes';
import {state} from '../client/state';


export default function render(req, res, locale) {
  const path = req.path;
  return loadData(path, locale)
    .then((appState) => renderPage(res, appState, path));
}

function loadData(path, locale) {
  // TODO: Preload and merge user specific state.
  const appState = initialState;
  return axios.get('https://www.wehkamp.com/nlbe/api/products?categoryPath=%2Fdamesmode%2Fblouses-tunieken%2F&page=1')
    .then((ajaxResponse) => {
      appState.products = ajaxResponse.data.products
        .map((product) => {
          return {
            title: product.websiteDescription,
            productId: product.productNumber,
            src: 'https://assets.wehkamp.com/i/wehkamp/' + product.productNumber + '_pb_01/' + product.normalizedName + '.jpg?$product300x300$'
          }
        });
      return appState;
    });
}

// TODO: Refactor.<commit_msg>fix server not parsing get parameter<commit_after>import DocumentTitle from 'react-document-title';
import axios from 'axios';
import Html from './html.react';
import Promise from 'bluebird';
import React from 'react';
import Router from 'react-router';
import config from './config';
import initialState from './initialstate';
import routes from '../client/routes';
import {state} from '../client/state';


export default function render(req, res, locale) {
  const url = req.originalUrl;
  return loadData(url, locale)
    .then((appState) => renderPage(res, appState, url));
}

function loadData(url, locale) {
  // TODO: Preload and merge user specific state.
  const appState = initialState;
  return axios.get('https://www.wehkamp.com/nlbe/api/products?categoryPath=%2Fdamesmode%2Fblouses-tunieken%2F&page=1')
    .then((ajaxResponse) => {
      appState.products = ajaxResponse.data.products
        .map((product) => {
          return {
            title: product.websiteDescription,
            productId: product.productNumber,
            src: 'https://assets.wehkamp.com/i/wehkamp/' + product.productNumber + '_pb_01/' + product.normalizedName + '.jpg?$product300x300$'
          }
        });
      return appState;
    });
}

// TODO: Refactor.
{'fraction_non_alphanumeric': 0.13804173354735153, 'fraction_numerical': 0.009630818619582664, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '1316824', 'n_tokens_mistral': 755, 'n_tokens_neox': 739, 'n_words': 184}