Skip to content

Instantly share code, notes, and snippets.

@Abeyy Abeyy/getHomeScreenObject.js Secret
Created Aug 29, 2018

Embed
What would you like to do?
GetHomeScreenObject() from Cosmic JS
async getResObject() {
const slug = 'home'
try {
const res = await bucket.getObject({ slug })
this.resObject = res
let metafields = res.object.metafields
metafields.map((field) => {
if (field.title == 'HomeScreenTitle') {
this.homeScreenTitle = field.value
}
if (field.title == 'HomeScreenImage') {
this.homeScreenImage = field.url
}
if (field.title = 'HomeScreenTitleImage') {
this.homeScreenTitleImage = field.url
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.