4.0.0-beta.1 • Published 6 years ago

@lab009/teide-router v4.0.0-beta.1

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
6 years ago

@lab009/teide-router

Dead simple router for @lab009/teide

Wraps react-router + react-router-redux and provides the simplest API possible. Built for @lab009/teide, but will work in any redux application.

Install

npm install --save @lab009/teide-router

Get Started

  • Import in the module
  • Add it to your store's plugins
  • Router state is now under router in your store

Example

import { createStore } from '@lab009/teide'
import * as router from '@lab009/teide-router'

// you get the point
let store = createStore({
  plugins: [ router ]
})

API

  • history
  • actions
  • reducers
  • middleware
  • hook

Components

These are all re-exported from react-router, the behavior is exactly the same. See the react-router documentation if you haven't used these before.

  • Router
  • Route
  • Link
  • Redirect
  • IndexRoute
  • IndexLink
  • IndexRedirect

Auth

handling authentication

Props
  • store - Redux store
  • options - Options Object
Options Object Keys
  • authSelector(state): authData (Function): A state selector for the auth data.
  • redirectAction (Function): action for redirecting the user.
  • [failureRedirectPath] (String): Optional path to redirect the browser to on a failed check. Defaults to /login
  • [predicate(authData): Bool] (Function): Optional function to be passed the result of the authSelector param. If it evaluates to false the browser will be redirected to failureRedirectPath.
  • [allowRedirectBack] (Bool): Optional bool on whether to pass a redirect query parameter to the failureRedirectPath
4.0.0-beta.1

6 years ago

4.0.0-beta.0

6 years ago

3.3.1

6 years ago

3.3.0

6 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago