Skip to content

Instantly share code, notes, and snippets.

@jazibsawar

jazibsawar/BlogFeed.js Secret

Created Jan 5, 2018
Embed
What would you like to do?
src/resources/BlogFeed.js
import _map from 'lodash.map'
export default {
feed() {
return {
path: '/object-type/posts',
resolve: (response, mappers) => {
let _posts = _map(response.objects, function(i) {
let temp = {
title: i.title,
image: i.metadata.image.imgix_url,
published: i.created_at,
author: i.metadata.author.title,
id: i.slug
};
return temp;
})
return mappers.pipe(_posts)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment