How to use the redux-rails.railsActions.index function in redux-rails

To help you get started, we’ve selected a few redux-rails examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instacart / redux-rails / demo / index.js View on Github external
resource: 'Posts',
    id: 3
  }))

  siteApp.dispatch(railsActions.show({
    resource: 'Posts',
    id: 5,
    controller: 'foo_posts'
  }))

  siteApp.dispatch(railsActions.show({
    resource: 'Comments',
    id: 15
  }))

  siteApp.dispatch(railsActions.index({resource: 'Photos'}))
    .then(resp => { 
      console.log('async photos: ', resp) 
    })
    .catch(err => {
      console.log('error' , err)
    })

  // siteApp.dispatch({
  //   type: 'User.SHOW'
  // })

  siteApp.dispatch(railsActions.show({
    resource: 'User'
  }))

  siteApp.dispatch({
github instacart / redux-rails / test / apiReducer.spec.js View on Github external
it('should set a loading state on the collection', () => {
      indexReducerState = indexReducer(indexReducerState, railsActions.index({ resource: 'Posts' }))

      expect(indexReducerState).toEqual(
        {
          Posts: {
            loading: true,
            loadingError: undefined
          },
          User: {
            loading: false,
            loadingError: undefined
          }
        }
      )
    })

redux-rails

Redux and your server talking without fuss.

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis