76 lines
2.1 KiB
JavaScript
76 lines
2.1 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/re_px.js"
|
|
window.api = api
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
get_data_status:0,
|
|
save_status:0,
|
|
dialog_golongandarah:false,
|
|
selected_golongandarah:{},
|
|
results:[],
|
|
onprocess:false,
|
|
images:[],
|
|
show_progrees_upload:false,
|
|
imagePreviews: [],
|
|
imageFiles: []
|
|
},
|
|
mutations: {
|
|
update_show_progrees_upload(state,value) {
|
|
state.show_progrees_upload = value
|
|
},
|
|
update_images(state,value) {
|
|
state.images = value
|
|
},
|
|
update_onprocess(state,value) {
|
|
state.onprocess = value
|
|
},
|
|
update_save_status(state,value) {
|
|
state.save_status = value
|
|
},
|
|
update_results(state,value) {
|
|
state.results = value
|
|
},
|
|
update_get_data_status(state,value) {
|
|
state.get_data_status = value
|
|
},
|
|
update_selected_golongandarah(state,value) {
|
|
state.selected_golongandarah = value
|
|
},
|
|
update_dialog_golongandarah(state,value) {
|
|
state.dialog_golongandarah = value
|
|
},
|
|
update_imagePreviews(state,value) {
|
|
state.imagePreviews = value
|
|
},
|
|
update_imageFiles(state,value) {
|
|
state.imageFiles = value
|
|
},
|
|
},
|
|
actions: {
|
|
async get_golongandarah(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getgolongandarah(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_imagePreviews", data.records['images'])
|
|
|
|
// context.commit("update_dialog_golongandarah", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
}
|
|
}
|
|
} |