refact post.js