23 lines
531 B
JavaScript
Vendored
23 lines
531 B
JavaScript
Vendored
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
|