diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index c6cfc442e..57d8e5025 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1354,9 +1354,9 @@ export default { dispatch("call", { url: 'project/lists', data: callData.get() - }).then(({data, xhr}) => { + }).then(({data}) => { dispatch("saveProject", data.data); - callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetProject", ids)) + callData.save(data).then(ids => dispatch("forgetProject", ids)) state.projectTotal = data.total_all; // resolve(data) @@ -1853,12 +1853,12 @@ export default { dispatch("call", { url: 'project/task/lists', data: callData.get() - }).then(({data, xhr}) => { + }).then(({data}) => { if (requestData.project_id) { state.projectLoad--; } dispatch("saveTask", data.data); - callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetTask", ids)) + callData.save(data).then(ids => dispatch("forgetTask", ids)) // if (data.next_page_url) { requestData.page = data.current_page + 1 @@ -2757,9 +2757,9 @@ export default { dispatch("call", { url: 'dialog/lists', data: callData.get() - }).then(({data, xhr}) => { + }).then(({data}) => { dispatch("saveDialog", data.data); - callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetDialog", ids)) + callData.save(data).then(ids => dispatch("forgetDialog", ids)) // if (data.current_page === 1) { dispatch("getDialogLatestMsgs", data.data.map(({id}) => id)) diff --git a/resources/assets/js/store/utils.js b/resources/assets/js/store/utils.js index cb0a6dc47..b8eb3026b 100644 --- a/resources/assets/js/store/utils.js +++ b/resources/assets/js/store/utils.js @@ -14,6 +14,7 @@ function __callData(key, requestData, state) { 'timerange', ])).toString()) const callData = state.callAt.find(item => item.key === callKey) || {} + callData.__last = $A.dayjs().unix() if (typeof callData.key === "undefined") { callData.key = callKey callData.updated = 0 @@ -34,16 +35,15 @@ function __callData(key, requestData, state) { * @param total * @param current_page * @param deleted_id - * @param serverDate * @returns {Promise} */ - this.save = ({total, current_page, deleted_id}, serverDate = undefined) => { + this.save = ({total, current_page, deleted_id}) => { return new Promise(async resolve => { if (current_page !== 1) { return } let hasUpdate = false - const time = $A.dayjs(serverDate).unix() + const time = callData.__last || $A.dayjs().unix() if (total > 0) { callData.updated = time hasUpdate = true