Skip to content

Instantly share code, notes, and snippets.

@jazibsawar
Created January 5, 2018 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazibsawar/bfcdf2dfeb980ae7987a914b28e72edc to your computer and use it in GitHub Desktop.
Save jazibsawar/bfcdf2dfeb980ae7987a914b28e72edc to your computer and use it in GitHub Desktop.
src/resources/BlogPost.js
export default {
post(id) {
return {
path: `/object/${id}`,
resolve: (response, mappers) => {
let { title, content, created_at, metadata } = response.object
let meta = {
description: metadata.description,
published: created_at,
author: metadata.author.title
}
return mappers.merge({ title, content, ...meta })
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment