Skip to content

Instantly share code, notes, and snippets.

@jazibsawar
Created January 5, 2018 13:47
Show Gist options
  • Save jazibsawar/5430f8ceba6378787540d790141edb91 to your computer and use it in GitHub Desktop.
Save jazibsawar/5430f8ceba6378787540d790141edb91 to your computer and use it in GitHub Desktop.
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