Created
July 28, 2018 22:08
-
-
Save mtermoul/0c99ec595e3b937787f83d640f8eadfc to your computer and use it in GitHub Desktop.
Fetching images from Cosmic JS and storing them back to vuex state.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
action: { | |
... | |
fetchStoreCardImages ({commit}) { | |
// will get the images from Cosmic js media folder and store in vuex | |
const params = { | |
folder: 'store-card-images' | |
} | |
Cosmic.getMedia(params) | |
.then(data => { | |
commit('SET_STORE_CARD_IMAGES', data.media) | |
}) | |
.catch(err => { | |
console.log(err) | |
}) | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment