[Sprint/LuckyLizard] (feat) remember hashtag on/off value
closes #1176
changed milestone to %sprint: Lucky Lizard
added MR::Awaiting Review Squad::Green scoped labels
- Last updated by Martin Santangelo
20 22 */ 21 23 @action.bound 22 24 async init() { 23 const data = await storageService.multiGet(['LeftHanded', 'AppLog', 'CreatorNsfw', 'ConsumerNsfw']); 25 const data = await storageService.multiGet(['LeftHanded', 'AppLog', 'CreatorNsfw', 'ConsumerNsfw', 'UseHashtags']); 24 26 if (!data) return; 25 27 this.leftHanded = data[0][1]; 26 28 this.appLog = data[1][1]; 27 29 this.creatorNsfw = data[2][1] || []; 28 30 this.consumerNsfw = data[3][1] || []; - Developer
After reading the documentation of multiGet, I don't understand why we're getting with string keys and then reading the array with integers
We should definitely being using constants to both store and retrieve data
https://github.com/react-native-community/async-storage/blob/LEGACY/docs/API.md#multiGet
- Developer
Ping @msantang78
- Maintainer
Because the result, as the multiGet doc says, is [ ['LeftHanded', 'somevalue'], ['AppLog', 'somevalue']....]
if I want to retrieve one particular result using the key I need to do something like:
this.leftHanded = result.find(r => r[0] == 'LeftHanded');
For every key
Maybe I can map the result as an Object inside the StorageService.multiGet()
So, instead of return an array with the format of the react-native's async-storage.multiGet, I can return something like
{LeftHanded: value, AppLog: value, ... }
Edited by Martin Santangelo
approved this merge request
approved this merge request
merged
mentioned in commit 350e49c0