<commit_before>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Redirect, withRouter } from 'react-router-dom'
import flow from 'lodash/flow'

import { KonnectorModal } from 'cozy-harvest-lib'
import { getKonnector } from 'ducks/konnectors'

import { getConnectionsByKonnector, getTriggersByKonnector } from 'reducers'
import { withClient } from 'cozy-client/dist/hoc'

class AccountPicker extends Component {
  render() {
    const { connections, konnector, history, triggers } = this.props
    const konnectorWithtriggers = { ...konnector, triggers: triggers }
    if (!connections.length)
      return <Redirect to={`/connected/${konnector.slug}/new`} />

    return (
      <KonnectorModal
        konnector={konnectorWithtriggers}
        dismissAction={() => {
          history.push('/')
        }}
        createAction={() => {
          history.push(`/connected/${konnector.slug}/new`)
        }}
      />
    )
  }
}

const mapStateToProps = (state, ownProps) => {
  const { konnectorSlug } = ownProps.match.params
  return {<commit_msg>fix: Better redirect after closing modal<commit_after>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Redirect, withRouter } from 'react-router-dom'
import flow from 'lodash/flow'

import { KonnectorModal } from 'cozy-harvest-lib'
import { getKonnector } from 'ducks/konnectors'

import { getConnectionsByKonnector, getTriggersByKonnector } from 'reducers'
import { withClient } from 'cozy-client/dist/hoc'

class AccountPicker extends Component {
  render() {
    const { connections, konnector, history, triggers } = this.props
    const konnectorWithtriggers = { ...konnector, triggers: triggers }
    if (!connections.length)
      return <Redirect to={`/connected/${konnector.slug}/new`} />

    return (
      <KonnectorModal
        konnector={konnectorWithtriggers}
        dismissAction={() => {
          history.push('/connected')
        }}
        createAction={() => {
          history.push(`/connected/${konnector.slug}/new`)
        }}
      />
    )
  }
}

const mapStateToProps = (state, ownProps) => {
  const { konnectorSlug } = ownProps.match.params
  return {
{'fraction_non_alphanumeric': 0.129981884057971, 'fraction_numerical': 0.0, 'mean_word_length': 3.331372549019608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '1986393', 'n_tokens_mistral': 686, 'n_tokens_neox': 683, 'n_words': 147}