add modules folder based on s_menu
This commit is contained in:
71
test/vuex/one-accone-list-task/modules/approve.js
Normal file
71
test/vuex/one-accone-list-task/modules/approve.js
Normal file
@@ -0,0 +1,71 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/approve.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_search: 0,
|
||||
lookup_error_message: "",
|
||||
|
||||
listdata: [],
|
||||
selected_data: {},
|
||||
loading: false,
|
||||
total_page: 0,
|
||||
current_page: 1,
|
||||
xsearch: ""
|
||||
},
|
||||
mutations: {
|
||||
update_lookup_search(state, val) {
|
||||
state.lookup_search = val
|
||||
},
|
||||
update_lookup_error_message(state, val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_listdata(state, val) {
|
||||
state.listdata = val
|
||||
},
|
||||
update_selected_data(state, val) {
|
||||
state.selected_data = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_xsearch(state, val) {
|
||||
state.xsearch = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_loading", true);
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token()
|
||||
}
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_search", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
context.commit("update_listdata", data.records)
|
||||
|
||||
context.commit("update_loading", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user