thewei / react-native-store

A simple database base on react-native AsyncStorage.
https://github.com/thewei/react-native-store
Other
569 stars 74 forks source link

Can't add multiple time #54

Open quangtruong16994 opened 7 years ago

quangtruong16994 commented 7 years ago

when I add more than 1 time, like: DB.zamba.add({ id: "account", value: { username: username, password: password, isSaveAccount: true } }); DB.zamba.add({ id: "isSaveAccount", value: { isSave: true } });

It only saves "isSaveAccount". How can I fix this?

kymar commented 7 years ago

Is this not because they return a promise and are not executed synchronously so you'd need like:

DB.zamba.add({ id: 'account', value: { username: username, password: password, isSaveAccount: true } }).then(() => DB.zamba.add({ id: 'isSaveAccount', value: {isSave: true} }) );