🐛 répare la sauvegarde automatique de la situation sur mycompanyinfrance

pull/439/head
Johan Girod 2019-01-31 19:43:20 +01:00
parent 29de00869e
commit 311ecbff82
7 changed files with 19 additions and 20 deletions

View File

@ -56,7 +56,8 @@ export default class Layout extends PureComponent {
enableBatching(reducers),
this.props.initialStore,
storeEnhancer
)
)
console.log(this.props.initialStore, this.store.getState())
this.props.onStoreCreated && this.props.onStoreCreated(this.store)
}
render() {

View File

@ -517,8 +517,8 @@ path:
démarcheEmbauche:
index: '/hiring-process'
Auto-entrepreneur en EIRL: auto-entrepreneur with EIRL option
auto-entrepreneur-EIRL: auto-entrepreneur-with-EIRL-option
Auto-entrepreneur en EIRL: Auto-entrepreneur with EIRL option
auto-entrepreneur-EIRL: auto-entrepreneur-EIRL
privacyContent: >
<0>$t(Vie privée)</0>
<1>

View File

@ -60,7 +60,7 @@ class InFranceRoute extends Component {
tracker={tracker}
sitePaths={paths}
reduxMiddlewares={middlewares}
onStoreCreated={persistEverything}
onStoreCreated={persistEverything()}
initialStore={{ ...retrievePersistedState() }}>
<TrackPageView />
<div id="content">

View File

@ -1,13 +1,13 @@
/* @flow */
import { React, T } from 'Components'
import { ScrollToTop } from 'Components/utils/Scroll'
import withSitePaths from 'Components/utils/withSitePaths'
import { compose } from 'ramda'
import { withNamespaces } from 'react-i18next'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import Animate from 'Ui/animate'
import siret from './siret.jpg'
import { React, T } from 'Components';
import { ScrollToTop } from 'Components/utils/Scroll';
import withSitePaths from 'Components/utils/withSitePaths';
import { compose } from 'ramda';
import { withNamespaces } from 'react-i18next';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import Animate from 'Ui/animate';
import siret from './siret.jpg';
import type { TFunction } from 'react-i18next'
type Props = {
@ -59,7 +59,7 @@ const AfterRegistration = ({ t, companyStatusChoice, sitePaths }: Props) => (
la nomenclature nationale d'activités françaises (code « NAF »).{' '}
<span
style={
companyStatusChoice.match(/auto-entrepreneur|EI/)
companyStatusChoice && companyStatusChoice.match(/auto-entrepreneur|EI/)
? { display: 'none' }
: {}
}>
@ -69,7 +69,7 @@ const AfterRegistration = ({ t, companyStatusChoice, sitePaths }: Props) => (
</span>
</T>
</p>
{!companyStatusChoice.includes('auto-entrepreneur') && (
{companyStatusChoice && !companyStatusChoice.includes('auto-entrepreneur') && (
<>
<h2>
<T k="après.kbis.titre">Le Kbis</T>

View File

@ -42,7 +42,6 @@ const CreateCompany = ({
const companyStatus = LANDING_LEGAL_STATUS_LIST.find(
status => t(status) === match.params.status
)
console.log('yopyop', status, companyStatus)
const isAutoentrepreneur = [
'auto-entrepreneur',
'auto-entrepreneur-EIRL'

View File

@ -32,7 +32,6 @@ const CreateMyCompany = ({
existingCompany,
sitePaths
}) => {
console.log('sitapath', sitePaths.entreprise.créer(':status'))
return (
<>
<Animate.fromBottom>

View File

@ -12,12 +12,12 @@ const VERSION = 1
const LOCAL_STORAGE_KEY = 'mycompanyinfrance::persisted-everything:v' + VERSION
type OptionsType = {
except: Array<string>
except?: Array<string>
}
export const persistEverything = ({ except = [] }:OptionsType) => (store: Store<State, Action>): void => {
export const persistEverything = (options?:OptionsType = {}) => (store: Store<State, Action>): void => {
const listener = () => {
const state = store.getState()
safeLocalStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(omit(except, state)))
safeLocalStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(omit(options.except || [], state)))
}
store.subscribe(debounce(1000, listener))
}