Files
FE_CPONE/test/vuex/one-process-resultentry-v5/modules/helper.js
2026-04-27 10:13:31 +07:00

40 lines
966 B
JavaScript

// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/helper.js"
export default {
namespaced: true,
state: {
loading:false,
error:''
},
mutations: {
update_calc_age_status(state,value) {
state.loading= value
},
update_error(state,value) {
state.error= value
}
},
actions: {
async calc_age(context,orderID) {
context.commit("update_loading", true)
try {
let prm = { orderID }
prm["token"] = one_token()
let resp = await api.calc_age(prm)
context.commit("update_loading",false)
if (resp.status != "OK") {
context.commit("update_error", resp.message)
} else {
context.commit("update_error", "")
}
} catch (e) {
context.commit("update_loading", false)
context.commit("update_error", e.message)
}
}
}
}