A Lore hook that generates an action and reducer for retriving the current user.

Usage no npm install needed!

<script type="module">
  import loreHookAuth from 'https://cdn.skypack.dev/lore-hook-auth';




Generates an action and reducer for handling retrieval and storage of the current user.


module.exports = {

   * The name of the model with a URL property set to the endpoint
   * that can return the current user.
  modelName: 'currentUser'

   * The name of the reducer that should be created that is responsible
   * for storing the current user. This defaults to the name of the
   * model.
  // reducerName: 'currentUser'

   * The name of the action that should be created at this responsible
   * for fetching the current user. This defaults to the name of the
   * model.
  // actionName: 'currentUser'


When using this hook you should also modify the dependencies array of the redux hook in index.jsto make sure it runs after this hook:

// index.js
  hooks: {
    auth: require('lore-hook-auth'),
    actions: require('lore-hook-actions'),
    bindActions: require('lore-hook-bind-actions'),
    connect: require('lore-hook-connect'),
    models: require('lore-hook-models'),
    reducers: require('lore-hook-reducers'),
    redux: _.extend(require('lore-hook-redux'), {
      dependencies: ['reducers', 'auth']