33 lines
801 B
JavaScript
Vendored
33 lines
801 B
JavaScript
Vendored
import m from "mithril"
|
|
|
|
const SectionQuestion = {
|
|
current: {},
|
|
list: [],
|
|
loading: false,
|
|
loadList: function(sectionId) {
|
|
SectionQuestion.loading = true
|
|
m.request({
|
|
url: "http://api.questionnaire.dev/v1/sections/" + sectionId + "/questions",
|
|
method: "GET"
|
|
})
|
|
.then(function(res) {
|
|
SectionQuestion.list = res
|
|
SectionQuestion.loading = false
|
|
})
|
|
},
|
|
nextOrPrev: function(url) {
|
|
SectionQuestion.loading = true
|
|
m.request({
|
|
url,
|
|
method: "GET"
|
|
})
|
|
.then(function(res) {
|
|
res.data = res.data[0]
|
|
SectionQuestion.current = res
|
|
SectionQuestion.loading = false
|
|
})
|
|
}
|
|
}
|
|
|
|
export default SectionQuestion
|