Public
Snippet $350 authored by Antoine

Routing Kresus

Edited
Routing.md

Relevé report/:accountId Default report/:defaultAccountId

Budget budget

Graphiques charts/:accountId/:chartType

Doublons duplicates/:accountId

Categories cateogries

Parametres settings/accounts (default) settings/alerts settings/default settings/save-and-restore settings/weboob

  • Routage principal
  • Charts
  • Settingshttps://github.com/ReactTraining/react-router/issues/4671
  • Charts mobile
  • Settings mobile
  • Ajouter un listener resize sur le composant "tab-menu" pour synchroniser le select et les routes
  • Rendre l'application accessible depuis plusieurs access point
  • Gérer le soucis de root
  • inclure basename dans history.push?
  • Gerer le soucis d'accès "profond" (depuis /settings/emails par exemple)
  • Inclure le current account dans l'url sout form de "?account=AccountID" -> router-redux?
  • Add link in code to https://github.com/ReactTraining/react-router/issues/4671 to explain why is wrapped in route/withRouter
if (weboobNotInstalled) {
        <Redirect
          to='/weboob-readme'
          push={ false }
        />
}

if (hasNoAccess) {
    return (
        <Redirect
          to='/initialize'
          push={ false }
        />
    );
}

if (currentAccount === null)
    return (
        <Redirect
          to='pathAvecInitialValue'
          push={ false }
        />
    );    
}

let main = 'blabla'

const initializeKresus = () => {
    if (hasNoAccess)  {
        return <InitializeKresus />;
    } else {
        return <Redirect to='/' />;
    }
}

const noBackend = () => {
    if (weboobNotInstalled) {
        return <WeboobReadme />;
    } else {
        return <Redirect to='/' />;
    }
}

return (
    <Switch>
        <Route
            path='/weboob-readme'
            render={ noBackend }
        />
        <Route
            path='/initialize/:subsection?'
            render={ initializeKresus }
        />
        <Route component={ main } />
    </Switch>
);