Skip to content

biesbjerg/ngrx-store-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngrx-store-sync

src/app/reducers/index.ts:

import { ActionReducerMap, MetaReducer, ActionReducer } from '@ngrx/store';

import { storeSync } from '@app/store-sync/reducers';

export interface State {}

export const reducers: ActionReducerMap<State> = {};
export const metaReducers: MetaReducer<any>[] = [storeSync];

src/app/app.module.ts:

import { reducers, metaReducers } from '@app/reducers';
...
@NgModule({
	imports: [
		BrowserModule,
		IonicModule.forRoot(),
		IonicStorageModule.forRoot(),
		StoreModule.forRoot(reducers, { metaReducers }),
		EffectsModule.forRoot([]),
		StoreSyncModule.forRoot({
			actionWhitelist: [
				AuthApiActions.ActionTypes.LoginSuccess,
				AuthApiActions.ActionTypes.LogoutSuccess,
				SettingsApiActions.ActionTypes.SetPreferredCatalogAndLanguage,
				SettingsPageActions.ActionTypes.SetCatalogAndLanguage,
				OnboardingPageActions.ActionTypes.SkipOnboarding
			],
			includeKeys: [
				'auth',
				'settings'
			]
		}),
		StoreRouterConnectingModule.forRoot(),
		...
	]
})
export class AppModule {}

StoreSyncModule has following config interface:

export interface StoreSyncConfig {
	storageKey?: string;
	actionWhitelist?: string[];
	actionBlacklist?: string[];
	includeKeys?: string[];
	excludeKeys?: string[];
	saveDelay?: number;
	saveDebounce?: number;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published