   (let [title (get-in request [:params :title])
         synopsis (get-in request [:params :synopsis])
         username (sess/username request)
-        story (st/create-story 
+        story (st/create-story
                 username title synopsis)]
     (-> (url/story-edit username (:id story))
         redirect

      enforce]]))

(defn user-owns-story [req]
  (when-not 
    (st/story-match-by (sess/username req) req)
    {:error "User does not own story"}))


                      (assoc-in [:params :data] data))]
      (handler request))))

(def the-routes
  (routes
    (POST url/story-create-path -> submit-story)

    (GET url/story-create-path -> page/story-create)

    (POST url/story-edit-path
          -> (wrap-parse-script resubmit-story))

    (GET url/story-edit-path
         -> (coerce enforce-user-owned-story page/story-edit))

    (POST url/story-delete-path -> delete-story)

    (GET url/story-delete-path ->
         (coerce enforce-user-owned-story page/story-delete))

    (GET url/user-index-path -> user-index)

    (GET url/story-index-path -> page/story-index)

    (GET url/story-data-path -> story-data)

    (GET url/story-path
         -> (coerce enforce-user-story page/story))

    (GET url/chapter-path
         -> (coerce enforce-user-story page/story))

    (GET url/scene-path
         -> (coerce enforce-user-story page/story))))





