api/index.js
// addCardToDeck: take in two arguments, id and card, and will add the card to the list of questions for the deck with the associated id and return the updated deck.
take in two arguments, id and card, and will add the card to the list of questions for the deck with the associated id and return the updated deck.
take in two arguments id and card and will add the card to the list of questions for the deck with the associated id and return the updated deck .
function addCardToDeck(id, card) {
    return AsyncStorage.getItem(DECKS_STORAGE_KEY)
        .then(result => {
            const decks = JSON.parse(result);
            decks[id].questions.push(card);
            return AsyncStorage.setItem(DECKS_STORAGE_KEY, JSON.stringify(decks))
                .then(() => decks[id]);
        });
}
function addCardToDeck ( id , card ) { return AsyncStorage . getItem ( DECKS_STORAGE_KEY ) . then ( result => { const decks = JSON . parse ( result ) ; decks [ id ] . questions . push ( card ) ; return AsyncStorage . setItem ( DECKS_STORAGE_KEY , JSON . stringify ( decks ) ) . then ( ( ) => decks [ id ] ) ; } ) ; }
addCardToDeck: take in two arguments, id and card, and will add the card to the list of questions for the deck with the associated id and return the updated deck.
addCardToDeck : take in two arguments id and card and will add the card to the list of questions for the deck with the associated id and return the updated deck .