Refresh selected user after search
This commit is contained in:
@@ -47,10 +47,20 @@ export default {
|
|||||||
context.commit('update_save_error_message', resp.message)
|
context.commit('update_save_error_message', resp.message)
|
||||||
} else {
|
} else {
|
||||||
let data = resp.data || {}
|
let data = resp.data || {}
|
||||||
context.commit('update_users', data.records || [])
|
let records = data.records || []
|
||||||
|
context.commit('update_users', records)
|
||||||
context.commit('update_total_rows', data.pagination ? data.pagination.total_rows : 0)
|
context.commit('update_total_rows', data.pagination ? data.pagination.total_rows : 0)
|
||||||
context.commit('update_total_pages', data.pagination ? data.pagination.total_pages : 0)
|
context.commit('update_total_pages', data.pagination ? data.pagination.total_pages : 0)
|
||||||
context.commit('update_limit', data.pagination ? data.pagination.limit : 20)
|
context.commit('update_limit', data.pagination ? data.pagination.limit : 20)
|
||||||
|
let selected = context.state.selected_user || {}
|
||||||
|
if (selected.User_ID) {
|
||||||
|
let refreshed = records.find(function (item) {
|
||||||
|
return item.User_ID == selected.User_ID
|
||||||
|
})
|
||||||
|
if (refreshed) {
|
||||||
|
context.commit('update_selected_user', refreshed)
|
||||||
|
}
|
||||||
|
}
|
||||||
context.commit('update_search_status', 2)
|
context.commit('update_search_status', 2)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user