UNPKG

rn-try-n-buy-abfrl

Version:

Virtual try-on plugin for ABFRL

30 lines (25 loc) 657 B
import AsyncStorage from '@react-native-async-storage/async-storage'; const saveItem = (key, data, callback = (response) => {}) => { AsyncStorage.setItem(key, data) .then((savedData) => { callback({status: 200, value: savedData}); }) .catch((error) => { callback({status: 400, value: null}); }); }; const retrieveData = (key, callback = (response) => {}) => { AsyncStorage.getItem(key).then((value) => { callback(value); }); }; const clearData = (key, callback = (response) => {}) => { AsyncStorage.removeItem(key).then(() => { callback(); }); }; export default { saveItem, retrieveData, clearData };