Skip to content

Commit

Permalink
Reset file input value after operations - fixed hoppscotch#1124
Browse files Browse the repository at this point in the history
  • Loading branch information
liyasthomas committed Aug 27, 2020
1 parent 240ae25 commit 62028d1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
6 changes: 4 additions & 2 deletions components/collections/import-export-collections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<input
type="file"
@change="replaceWithJSON"
style="display: none;"
style="display: none"
ref="inputChooseFileToReplaceWith"
accept="application/json"
/>
Expand All @@ -47,7 +47,7 @@
<input
type="file"
@change="importFromJSON"
style="display: none;"
style="display: none"
ref="inputChooseFileToImportFrom"
accept="application/json"
/>
Expand Down Expand Up @@ -126,6 +126,7 @@ export default {
this.syncToFBCollections()
}
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0])
this.$refs.inputChooseFileToReplaceWith.value = ""
},
importFromJSON() {
let reader = new FileReader()
Expand All @@ -147,6 +148,7 @@ export default {
this.syncToFBCollections()
}
reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0])
this.$refs.inputChooseFileToImportFrom.value = ""
},
exportJSON() {
let text = this.collectionJson
Expand Down
6 changes: 4 additions & 2 deletions components/environments/import-export-environment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<input
type="file"
@change="replaceWithJSON"
style="display: none;"
style="display: none"
ref="inputChooseFileToReplaceWith"
accept="application/json"
/>
Expand All @@ -47,7 +47,7 @@
<input
type="file"
@change="importFromJSON"
style="display: none;"
style="display: none"
ref="inputChooseFileToImportFrom"
accept="application/json"
/>
Expand Down Expand Up @@ -116,6 +116,7 @@ export default {
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0])
this.fileImported()
this.syncToFBEnvironments()
this.$refs.inputChooseFileToReplaceWith.value = ""
},
importFromJSON() {
let reader = new FileReader()
Expand All @@ -133,6 +134,7 @@ export default {
}
reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0])
this.syncToFBEnvironments()
this.$refs.inputChooseFileToImportFrom.value = ""
},
importFromPostwoman(environments) {
let confirmation = this.$t("file_imported")
Expand Down
1 change: 1 addition & 0 deletions pages/doc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ export default {
icon: "attach_file",
})
}
this.$refs.collectionUpload.value = ""
},
getDoc() {
Expand Down
14 changes: 8 additions & 6 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@
})
"
>
<option value="query" :selected="param.type === 'query'">{{
$t("query")
}}</option>
<option value="path" :selected="param.type === 'path'">{{
$t("path")
}}</option>
<option value="query" :selected="param.type === 'query'">
{{ $t("query") }}
</option>
<option value="path" :selected="param.type === 'path'">
{{ $t("path") }}
</option>
</select>
</span>
</li>
Expand Down Expand Up @@ -2570,6 +2570,7 @@ export default {
icon: "attach_file",
})
}
this.$refs.attachment.value = ""
},
uploadPayload() {
this.rawInput = true
Expand All @@ -2588,6 +2589,7 @@ export default {
icon: "attach_file",
})
}
this.$refs.payload.value = ""
},
async handleAccessTokenRequest() {
if (this.oidcDiscoveryUrl === "" && (this.authUrl === "" || this.accessTokenUrl === "")) {
Expand Down

0 comments on commit 62028d1

Please sign in to comment.