Skip to content

Commit

Permalink
Remove no longer needed "showUploadEditor"
Browse files Browse the repository at this point in the history
As "showUploadEditor" is true only when "currentUploadId" is set and
false otherwise there is no need to use a separate variable.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Nov 6, 2020
1 parent 4777e75 commit 2c96454
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/UploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
},

showModal() {
return this.$store.getters.showUploadEditor
return !!this.currentUploadId
},

addMoreAriaLabel() {
Expand Down
14 changes: 0 additions & 14 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const state = {
uploads: {
},
currentUploadId: undefined,
showUploadEditor: false,
}

const getters = {
Expand Down Expand Up @@ -87,10 +86,6 @@ const getters = {
currentUploadId: (state) => {
return state.currentUploadId
},

showUploadEditor: (state) => {
return state.showUploadEditor
},
}

const mutations = {
Expand Down Expand Up @@ -168,11 +163,6 @@ const mutations = {
state.currentUploadId = currentUploadId
},

// Shows hides the upload editor
showUploadEditor(state, show) {
state.showUploadEditor = show
},

removeFileFromSelection(state, fileId) {
const uploadId = state.currentUploadId
for (const key in state.uploads[uploadId].files) {
Expand All @@ -192,8 +182,6 @@ const actions = {
initialiseUpload({ commit, dispatch }, { uploadId, token, files }) {
// Set last upload id
commit('setCurrentUploadId', uploadId)
// Show upload editor
commit('showUploadEditor', true)

files.forEach(file => {
// Get localurl for previews
Expand All @@ -216,7 +204,6 @@ const actions = {
discardUpload({ commit, state, getters }, uploadId) {
if (state.currentUploadId === uploadId) {
commit('setCurrentUploadId', undefined)
commit('showUploadEditor', false)
}

commit('discardUpload', { uploadId })
Expand All @@ -230,7 +217,6 @@ const actions = {
async uploadFiles({ commit, dispatch, state, getters }, uploadId) {
if (state.currentUploadId === uploadId) {
commit('setCurrentUploadId', undefined)
commit('showUploadEditor', false)
}

EventBus.$emit('uploadStart')
Expand Down

0 comments on commit 2c96454

Please sign in to comment.