// 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) } } } }