Skip to content

Instantly share code, notes, and snippets.

@dpalita
Created August 2, 2018 20:09
Show Gist options
  • Save dpalita/8c93ebff9ded0ad566c79862b836d7d3 to your computer and use it in GitHub Desktop.
Save dpalita/8c93ebff9ded0ad566c79862b836d7d3 to your computer and use it in GitHub Desktop.
Use the AppInitAction and the previously stored initial state to bootstrap the app
@Injectable()
export class AccountReducer extends EntityReducer<Account> {
private initialState: AccountState
createReducer() {
return (state: AccountState, action: Action) => {
if (action instanceof AppInitAction && state === undefined) {
return initialState
} else {
...
}
}
}
bootstrap(): Promise<void> {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment