Skip to content

Commit

Permalink
feat: remove item from storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitarcitano committed Jul 4, 2021
1 parent ed19fa6 commit d7f07a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { apiClient } from './clients/api';
import { setStorageItem, getStorageItem } from './storage';
import { setStorageItem, getStorageItem, removeStorageItem } from './storage';
import { Login } from './auth';
import { AuthProvider, useAuth } from './auth/Provider';

export {
getStorageItem,
setStorageItem,
removeStorageItem,
apiClient,
Login,
AuthProvider,
Expand Down
8 changes: 8 additions & 0 deletions src/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ export async function setStorageItem(itemKey: string, data: unknown) {
throw new Error(err);
}
}

export async function removeStorageItem(itemKey: string) {
try {
await AsyncStorage.removeItem(itemKey);
} catch (err) {
throw new Error(err);
}
}

0 comments on commit d7f07a9

Please sign in to comment.