Giter Club home page Giter Club logo

Comments (4)

jimmylee avatar jimmylee commented on May 28, 2024 1

Here is an example from their documentation for ES6:

import { createStore, combineReducers } from 'redux';
import { reducer as formReducer } from 'redux-form';

const reducers = {
  // ... your other reducers here ...
  form: formReducer
};
const reducer = combineReducers(reducers);
const store = createStore(reducer);

You would add the necessary lines here: https://github.com/jimmylee/next-postgres/blob/master/common/store.js

I hope this helps :-) thanks for checking the repo out.

from next-postgres-sequelize.

si-acus avatar si-acus commented on May 28, 2024

i was try it but other errors appear.

Unexpected keys "post", "users", "posts", "comments", "isAuthenticated", "viewer" found in preloadedState argument passed to createStore. Expected to find one of the known reducer keys instead: "form". Unexpected keys will be ignored.
TypeError: Cannot read property 'length' of undefined

how to move own reducer from root,

const mergeLogoutState = state => {
  return { ...state, isAuthenticated: false, viewer: undefined };
};

const myReducer = (state = INITIAL_STATE, action) => {
  switch (action.type) {
    case 'UPDATE_STORE_KEYS':
      return mergeUpdatedKeys(action.data, state);
    case 'VIEWER_AUTHENTICATED':
      return mergeAuthState(action, state);
    case 'VIEWER_LOGOUT':
      return mergeLogoutState(state);
    default:
      return state;
  }
};
const reducers = {
      myReducer,
    form: formReducer
};
const reducer = combineReducers(reducers);

export const initStore = initialState => {
  return createStore(reducer, initialState, applyMiddleware(thunkMiddleware));
};

thank you for responding quickly :-)

from next-postgres-sequelize.

jimmylee avatar jimmylee commented on May 28, 2024

I'm sorry for the delay on my response, I'll try to reproduce your scenario but it should just work out of the box.

from next-postgres-sequelize.

si-acus avatar si-acus commented on May 28, 2024

i found to solve this, use next-redux-wrapper for get data and for check is authenticatedset getInitialProps in class

static async getInitialProps(ctx) {
        return ctx ? { isAuthenticated : ctx.req.isAuthenticated() , currentUser : ctx.req.user }: { isAuthenticated : null}

    }

thanks @jimmylee for awesome project

from next-postgres-sequelize.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.