Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
changePage({ state }, mutations) {
rehydrate(state, mutations || [])
switch (state.page) {
case 'Index':
// Do some additional logic
break
case 'About':
// Do some additional logic
break
default:
break
}
},
},
constructor(props) {
super(props)
const mutations = props.pageProps.mutations || []
if (typeof window !== 'undefined') {
// On the client we just instantiate the Overmind instance and run
// the "changePage" action
this.overmind = createOvermind(config)
this.overmind.actions.changePage(mutations)
} else {
// On the server we rehydrate the mutations to an SSR instance of Overmind,
// as we do not want to run any additional logic here
this.overmind = createOvermindSSR(config)
rehydrate(this.overmind.state, mutations)
}
}
// CLIENT: After initial route, on page change