Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: clean input value in modals - fixed #1662

liyasthomasc98de5988e32
diff --git a/components/collections/Add.vue b/components/collections/Add.vue
index bee565abe..8e8dc3535 100644
--- a/components/collections/Add.vue
+++ b/components/collections/Add.vue
@@ -43,16 +43,17 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
addNewCollection() {
this.$emit("submit", this.name)
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}
diff --git a/components/collections/AddFolder.vue b/components/collections/AddFolder.vue
index 12905a8ca..0069261f2 100644
--- a/components/collections/AddFolder.vue
+++ b/components/collections/AddFolder.vue
@@ -46,7 +46,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
@@ -56,8 +56,10 @@ export default {
folder: this.folder,
path: this.folderPath || `${this.collectionIndex}`,
})
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/collections/Edit.vue b/components/collections/Edit.vue
index c1b8cf9ca..6c8dd5886 100644
--- a/components/collections/Edit.vue
+++ b/components/collections/Edit.vue
@@ -44,16 +44,17 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
saveCollection() {
this.$emit("submit", this.name)
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}
diff --git a/components/collections/EditFolder.vue b/components/collections/EditFolder.vue
index ca345464b..f300a928f 100644
--- a/components/collections/EditFolder.vue
+++ b/components/collections/EditFolder.vue
@@ -42,14 +42,16 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
editFolder() {
this.$emit("submit", this.name)
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/collections/EditRequest.vue b/components/collections/EditRequest.vue
index 7d92c5763..d2f1bb655 100644
--- a/components/collections/EditRequest.vue
+++ b/components/collections/EditRequest.vue
@@ -45,15 +45,17 @@ export default {
data() {
return {
requestUpdateData: {
- name: undefined,
+ name: null,
},
}
},
methods: {
saveRequest() {
this.$emit("submit", this.requestUpdateData)
+ this.hideModal()
},
hideModal() {
+ this.requestUpdateData = { name: null }
this.$emit("hide-modal")
},
},
diff --git a/components/collections/graphql/Add.vue b/components/collections/graphql/Add.vue
index 1c908f32b..c94e34de0 100644
--- a/components/collections/graphql/Add.vue
+++ b/components/collections/graphql/Add.vue
@@ -45,7 +45,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
@@ -70,12 +70,12 @@ export default {
name: this.$data.name,
flag: "graphql",
})
- this.$emit("hide-modal")
this.syncCollections()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}
diff --git a/components/collections/graphql/AddFolder.vue b/components/collections/graphql/AddFolder.vue
index 12905a8ca..d46f93a40 100644
--- a/components/collections/graphql/AddFolder.vue
+++ b/components/collections/graphql/AddFolder.vue
@@ -37,6 +37,8 @@
</template>
<script>
+import { fb } from "~/helpers/fb"
+
export default {
props: {
show: Boolean,
@@ -46,18 +48,33 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(
+ JSON.parse(
+ JSON.stringify(this.$store.state.postwoman.collectionsGraphql)
+ ),
+ "collectionsGraphql"
+ )
+ }
+ }
+ },
addFolder() {
this.$emit("add-folder", {
name: this.name,
folder: this.folder,
path: this.folderPath || `${this.collectionIndex}`,
})
+ this.syncCollections()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/collections/graphql/Edit.vue b/components/collections/graphql/Edit.vue
index e3aee145e..bbf99bc3a 100644
--- a/components/collections/graphql/Edit.vue
+++ b/components/collections/graphql/Edit.vue
@@ -47,7 +47,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
@@ -77,10 +77,11 @@ export default {
collectionIndex: this.$props.editingCollectionIndex,
flag: "graphql",
})
- this.$emit("hide-modal")
this.syncCollections()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/collections/graphql/EditFolder.vue b/components/collections/graphql/EditFolder.vue
index e660171c2..7dacd9a17 100644
--- a/components/collections/graphql/EditFolder.vue
+++ b/components/collections/graphql/EditFolder.vue
@@ -48,7 +48,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
@@ -72,10 +72,11 @@ export default {
folderName: this.$props.folder.name,
flag: "graphql",
})
- this.hideModal()
this.syncCollections()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/collections/graphql/EditRequest.vue b/components/collections/graphql/EditRequest.vue
index 9cb078d72..2b4390078 100644
--- a/components/collections/graphql/EditRequest.vue
+++ b/components/collections/graphql/EditRequest.vue
@@ -51,7 +51,7 @@ export default {
data() {
return {
requestUpdateData: {
- name: undefined,
+ name: null,
},
}
},
@@ -82,11 +82,11 @@ export default {
requestIndex: this.$props.requestIndex,
flag: "graphql",
})
-
- this.hideModal()
this.syncCollections()
+ this.hideModal()
},
hideModal() {
+ this.requestUpdateData = { name: null }
this.$emit("hide-modal")
},
},
diff --git a/components/environments/Add.vue b/components/environments/Add.vue
index fa68e08ec..d838ce31d 100644
--- a/components/environments/Add.vue
+++ b/components/environments/Add.vue
@@ -46,7 +46,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
subscriptions() {
@@ -77,12 +77,12 @@ export default {
environments: newEnvironment,
confirmation: "Environment added",
})
- this.$emit("hide-modal")
this.syncEnvironments()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}
diff --git a/components/environments/Edit.vue b/components/environments/Edit.vue
index 9bff9057b..dc998a525 100644
--- a/components/environments/Edit.vue
+++ b/components/environments/Edit.vue
@@ -125,7 +125,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
doneButton: '<i class="material-icons">done</i>',
}
},
@@ -212,12 +212,12 @@ export default {
environment: environmentUpdated,
environmentIndex: this.$props.editingEnvironmentIndex,
})
- this.$emit("hide-modal")
this.syncEnvironments()
+ this.hideModal()
},
hideModal() {
+ this.name = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}
diff --git a/components/teams/Add.vue b/components/teams/Add.vue
index 7697370ed..ba57307ac 100644
--- a/components/teams/Add.vue
+++ b/components/teams/Add.vue
@@ -51,7 +51,7 @@ export default {
},
data() {
return {
- name: undefined,
+ name: null,
}
},
methods: {
@@ -79,9 +79,10 @@ export default {
// We restore the initial user input
this.name = name
})
+ this.hideModal()
},
hideModal() {
- this.$data.name = undefined
+ this.name = null
this.$emit("hide-modal")
},
},
diff --git a/components/teams/Edit.vue b/components/teams/Edit.vue
index 0cb4d858d..ff563c555 100644
--- a/components/teams/Edit.vue
+++ b/components/teams/Edit.vue
@@ -398,8 +398,8 @@ export default {
this.newMembers = []
},
hideModal() {
+ this.rename = null
this.$emit("hide-modal")
- this.$data.name = undefined
},
},
}