Comments (4)
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.
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.
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.
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)
- Not working locally HOT 1
- Clean install has issues with babel-cli HOT 3
- Using with decoupled API? HOT 4
- How to connect hosted postgres database secrets? HOT 5
- Sequelize 5 Warning HOT 1
- Comment timestamps are initialized as NaN-NaN-NaN during SSR
- Suggestion on how to fetch data on a per page basis? HOT 7
- Needs an update to the latest version of NextJS and a switch over to Knex
- wanna ask somthing HOT 2
- Change paths for textarea, moved under higher-order HOT 2
- Building Production Version with Now? HOT 4
- Handling modal state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-postgres-sequelize.