about summary refs log tree commit diff stats
path: root/src/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions.js')
-rw-r--r--src/actions.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/actions.js b/src/actions.js
index e6d7f98..2ad0c77 100644
--- a/src/actions.js
+++ b/src/actions.js
@@ -3,19 +3,22 @@
 const fs = require("fs");
 const path = require("path");
 const send = require("koa-send");
-const responders = require("./responders");
 
-function home(config, posts) {
+function home(config, responder, posts) {
   const postsArray = Array.from(posts.values());
   return async function(ctx, next) {
-    responders.home(ctx, config, postsArray);
+    responder(ctx, config, { posts: postsArray });
   };
 }
 
-function posts(config, posts) {
+function posts(config, responder, posts) {
   const postsArray = Array.from(posts.values());
   return async function(ctx, next) {
-    responders.list(ctx, config, null, "Posts", postsArray);
+    responder(ctx, config, {
+      listType: null,
+      listName: "Posts",
+      posts: postsArray
+    });
   };
 }
 
@@ -38,23 +41,27 @@ function highlightTheme(config) {
   };
 }
 
-function post(config, posts) {
+function post(config, responder, posts) {
   return async function(ctx, next) {
     ctx.assert(posts.has(ctx.params.filename), 404, "Post not found");
     const post = posts.get(ctx.params.filename);
 
-    responders.post(ctx, config, post);
+    responder(ctx, config, { post });
   };
 }
 
-function taxonGenerator(config, term, items) {
+function taxonGenerator(config, responder, term, items) {
   return async function(ctx, next) {
     const value = ctx.params.value;
     ctx.assert(items.has(ctx.params.value), 404, `${term} ${value} not found`);
 
     const taxonItems = items.get(value);
 
-    responders.list(ctx, config, term, value, taxonItems);
+    responder(ctx, config, {
+      listType: term,
+      listName: value,
+      posts: taxonItems
+    });
   };
 }