try {
const characterPrivateRef = firestore().doc(`characters/${uid}`);
const usernameRef = firestore().doc(`usernames/${username}`);
firestore().batch().batch.create(characterRef, {...characterData});
firestore().batch().batch.create(characterPrivateRef, {...usernameData});
await firestore().batch().commit();
// How can I get data written to each firestore document from batch
here?
} catch (e) {
// How can I check what batch failed here i.e. if it was username I
want to show error saying something like ("Username already exists")
}