import m from "mithril"

const Question = {
    current: {},
    list: [],
    loading: false,
    fetchCurrent: function(sectionId, url) {
        Question.loading = true
        if (_.isNil(url)) url = "http://api.questionnaire.dev/v1/sections/" + sectionId + "/questions"
        m.request({
            url,
            method: "GET",
        })
        .then(function(res) {
            res.data = res.data[0]
            Question.current = res
            Question.loading = false
        })
    }
}

export default Question
