Flatten nested repos
This commit is contained in:
39
test/vuex/one-process-resultentry-eng/modules/helper.js
Normal file
39
test/vuex/one-process-resultentry-eng/modules/helper.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user