Skip to content

Commit

Permalink
feat(capacitor): migrate to new version
Browse files Browse the repository at this point in the history
- replace storage with preferences plugin
  • Loading branch information
SimonGolms committed Aug 25, 2022
1 parent 736f366 commit 19dacfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/capacitorStorage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Storage as storage } from '@capacitor/storage';
import { Preferences } from '@capacitor/preferences';
import { type Storage } from 'redux-persist';

export const capacitorStorage: Storage = {
getItem: async (key: string) => {
const { value } = await storage.get({ key });
const { value } = await Preferences.get({ key });
return value || '';
},
removeItem: async (key: string) => {
return storage.remove({ key });
return Preferences.remove({ key });
},
setItem: async (key: string, value: string) => {
return storage.set({ key, value });
return Preferences.set({ key, value });
},
};

0 comments on commit 19dacfa

Please sign in to comment.