persist state on ios/iphone not working #248
Web2Integrators
started this conversation in
General
Replies: 2 comments
-
I don't think you can use the web storage in ios application. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can just use import {StateStorage} from '@ngneat/elf-persist-state';
import {Storage} from '@ionic/storage';
const storage = new Storage();
storage.create();
export const ionicStateStorage: StateStorage = {
getItem: <T extends Record<string, any>>(key: string): Promise<T | undefined> => storage.get(key),
removeItem: async (key: string): Promise<boolean> => {
await storage.remove(key);
return true;
},
setItem: async (key: string, value: Record<string, any>): Promise<boolean> => {
await storage.set(key, value);
return true;
}
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using ionic app to build ios app.
PersisState plug in is retrieving data for previous user.
const persist = persistState(store, {
key: loggedInUserEmail + ':patient-profile',
storage: localStorageStrategy,
source: () =>
store.pipe(tap((state) => console.log('state changed', state))),
preStoreInit: (value) => {
return value;
},
});
I am having uniqe keys for user which is there email address.
This is working fine while testing in chrome
Beta Was this translation helpful? Give feedback.
All reactions