Commit 791ece58 authored by Matěj Lang's avatar Matěj Lang
Browse files

Clean unnecessary number of post requests.

parent e03659f1
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -115,9 +115,6 @@ export default {
    },
    // ---

    pendingPostRequestsCount() {
      return this.$store.getters.pendingPostRequestsCount
    },
    hasUncommitedChanges() {
      return this.$store.getters.hasUncommitedChanges
    },
+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
      )
  })
}

@@ -449,6 +434,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
@@ -227,9 +227,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
@@ -128,9 +128,6 @@ export default {
  },
  SET_SERVER_PENDING_CHANGES(state, value) {
    state.server.hasPendingChanges = value
  },
  SET_NUMBER_PENDING_POST_REQUESTS(state, value) {
    state.server.numPendingPostRequests = value
  }
  // addStick(state, { cameraID, imageName, stickID, stickData, webCmd }) {
  //   // _sendPostRequest(state, webCmd)
Loading