Commit 69be4ff3 authored by Matěj Lang's avatar Matěj Lang
Browse files

Clean unnecessary number of post requests.

parent 49cd64af
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -7,23 +7,8 @@ const _sendPostRequest = (state, commit, webCmd, isCommit = false) => {
    return
  }
  commit('SET_SERVER_PENDING_CHANGES', !isCommit)
  commit(
    'SET_NUMBER_PENDING_POST_REQUESTS',
    state.server.numPendingPostRequests + 1
  )
  return webCmd()
    .then(() => {
      commit(
        'SET_NUMBER_PENDING_POST_REQUESTS',
        state.server.numPendingPostRequests - 1
      )
    })
    .catch(err => {
  return webCmd().catch(err => {
    console.log('POST failed: ' + err)
      commit(
        'SET_NUMBER_PENDING_POST_REQUESTS',
        state.server.numPendingPostRequests - 1
      )
  })
}

@@ -411,6 +396,7 @@ export default {
  commitChangesToDisk({ state, commit }) {
    const webCmd = () => DatasetService.commitChangesToDisk()
    _sendPostRequest(state, commit, webCmd)
    commit('SET_SERVER_PENDING_CHANGES', false)
  },
  setActivePoint({ commit, getters, state }, { stickID, cameraID, imageName }) {
    // Check stickID and cameraID validity.
+0 −3
Original line number Diff line number Diff line
@@ -221,9 +221,6 @@ export default {
    return result
  },

  pendingPostRequestsCount: state => {
    return state.server.numPendingPostRequests
  },
  hasUncommitedChanges: state => {
    return state.server.hasPendingChanges
  },
+0 −1
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ export default new Vuex.Store({
    },
    redrawTrigger: false, // Value is not important, the change of state will trigger chart redrawing.
    server: {
      numPendingPostRequests: 0,
      hasPendingChanges: false
    },
    filters: {
+0 −3
Original line number Diff line number Diff line
@@ -116,8 +116,5 @@ export default {
  },
  SET_SERVER_PENDING_CHANGES(state, value) {
    state.server.hasPendingChanges = value
  },
  SET_NUMBER_PENDING_POST_REQUESTS(state, value) {
    state.server.numPendingPostRequests = value
  }
}
+0 −3
Original line number Diff line number Diff line
@@ -54,9 +54,6 @@ export default {
    activeImageName() {
      return this.$store.getters.activeImageName(this.activeCamera)
    },
    pendingPostRequestsCount() {
      return this.$store.getters.pendingPostRequestsCount
    },
    cameraStatusGUI() {
      let result = {}
      for (const ID of this.cameraIDs) {