Last active
February 24, 2020 15:28
-
-
Save lrlineroa/dbf273d8ba4aa0c3306775ea48bbfb83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AsyncStorage from '@react-native-community/async-storage'; | |
class AppAsyncStorage { | |
static storeData = async (key, value) => { | |
try { | |
await AsyncStorage.setItem(key, value); | |
} catch (error) { | |
console.log("error storing" + error) | |
} | |
}; | |
static retrieveData = async (key) => { | |
try { | |
let value = await AsyncStorage.getItem(key); | |
return value; | |
} catch (error) { | |
console.log("error at fetching") | |
} | |
} | |
static removeItem = async (key) => { | |
try { | |
await AsyncStorage.removeItem(key); | |
return true; | |
} | |
catch (exception) { | |
console.log(exception) | |
return false; | |
} | |
} | |
static clearData = async () => { | |
try { | |
await AsyncStorage.clear(); | |
} catch (error) { | |
console.log(error) | |
} | |
} | |
} | |
export default AppAsyncStorage; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment