import m from "mithril" const Category = { current: {}, list: [], fetch: function(id) { m.request({ url: "http://api.questionnaire.dev/v1/categories/" + id, method: "GET" }) .then(function(res) { Category.current = res }) }, loadList: function() { m.request({ url: "http://api.questionnaire.dev/v1/categories", method: "GET" }) .then(function(res) { Category.list = res }) } } export default Category