lore-hook-auth
Provides an action and reducer dedicated to fetching the current user
Provides an action and reducer dedicated to fetching the current user
Generates actions for retrieving and updating the current user, along with a reducer for storing the current user.
First install the hook:
npm install lore-hook-auth --save
Then add the hook to your index.js
file.
Because this hook generates a reducer, you also need to modify the dependencies array of the redux
hook in order to make sure it runs after this hook, so that the reducer is guaranteed to exist when the Redux store is built.
// index.js
import auth from 'lore-hook-auth';
import redux from 'lore-hook-redux';
lore.summon({
hooks: {
auth,
...,
redux: _.extend(redux, {
dependencies: ['reducers', 'auth']
}),
...
}
});
The source code for this hook can be found here.