fix: clean input value in modals - fixed #1662

This commit is contained in:
liyasthomas
2021-05-20 14:24:14 +05:30
parent ca5df588b7
commit c98de5988e
14 changed files with 55 additions and 27 deletions

View File

@@ -43,16 +43,17 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
addNewCollection() { addNewCollection() {
this.$emit("submit", this.name) this.$emit("submit", this.name)
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }

View File

@@ -46,7 +46,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
@@ -56,8 +56,10 @@ export default {
folder: this.folder, folder: this.folder,
path: this.folderPath || `${this.collectionIndex}`, path: this.folderPath || `${this.collectionIndex}`,
}) })
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -44,16 +44,17 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
saveCollection() { saveCollection() {
this.$emit("submit", this.name) this.$emit("submit", this.name)
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }

View File

@@ -42,14 +42,16 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
editFolder() { editFolder() {
this.$emit("submit", this.name) this.$emit("submit", this.name)
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -45,15 +45,17 @@ export default {
data() { data() {
return { return {
requestUpdateData: { requestUpdateData: {
name: undefined, name: null,
}, },
} }
}, },
methods: { methods: {
saveRequest() { saveRequest() {
this.$emit("submit", this.requestUpdateData) this.$emit("submit", this.requestUpdateData)
this.hideModal()
}, },
hideModal() { hideModal() {
this.requestUpdateData = { name: null }
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -45,7 +45,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
@@ -70,12 +70,12 @@ export default {
name: this.$data.name, name: this.$data.name,
flag: "graphql", flag: "graphql",
}) })
this.$emit("hide-modal")
this.syncCollections() this.syncCollections()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }

View File

@@ -37,6 +37,8 @@
</template> </template>
<script> <script>
import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
show: Boolean, show: Boolean,
@@ -46,18 +48,33 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { 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() { addFolder() {
this.$emit("add-folder", { this.$emit("add-folder", {
name: this.name, name: this.name,
folder: this.folder, folder: this.folder,
path: this.folderPath || `${this.collectionIndex}`, path: this.folderPath || `${this.collectionIndex}`,
}) })
this.syncCollections()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -47,7 +47,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
@@ -77,10 +77,11 @@ export default {
collectionIndex: this.$props.editingCollectionIndex, collectionIndex: this.$props.editingCollectionIndex,
flag: "graphql", flag: "graphql",
}) })
this.$emit("hide-modal")
this.syncCollections() this.syncCollections()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -48,7 +48,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
@@ -72,10 +72,11 @@ export default {
folderName: this.$props.folder.name, folderName: this.$props.folder.name,
flag: "graphql", flag: "graphql",
}) })
this.hideModal()
this.syncCollections() this.syncCollections()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -51,7 +51,7 @@ export default {
data() { data() {
return { return {
requestUpdateData: { requestUpdateData: {
name: undefined, name: null,
}, },
} }
}, },
@@ -82,11 +82,11 @@ export default {
requestIndex: this.$props.requestIndex, requestIndex: this.$props.requestIndex,
flag: "graphql", flag: "graphql",
}) })
this.hideModal()
this.syncCollections() this.syncCollections()
this.hideModal()
}, },
hideModal() { hideModal() {
this.requestUpdateData = { name: null }
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -46,7 +46,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
subscriptions() { subscriptions() {
@@ -77,12 +77,12 @@ export default {
environments: newEnvironment, environments: newEnvironment,
confirmation: "Environment added", confirmation: "Environment added",
}) })
this.$emit("hide-modal")
this.syncEnvironments() this.syncEnvironments()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }

View File

@@ -125,7 +125,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
doneButton: '<i class="material-icons">done</i>', doneButton: '<i class="material-icons">done</i>',
} }
}, },
@@ -212,12 +212,12 @@ export default {
environment: environmentUpdated, environment: environmentUpdated,
environmentIndex: this.$props.editingEnvironmentIndex, environmentIndex: this.$props.editingEnvironmentIndex,
}) })
this.$emit("hide-modal")
this.syncEnvironments() this.syncEnvironments()
this.hideModal()
}, },
hideModal() { hideModal() {
this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }

View File

@@ -51,7 +51,7 @@ export default {
}, },
data() { data() {
return { return {
name: undefined, name: null,
} }
}, },
methods: { methods: {
@@ -79,9 +79,10 @@ export default {
// We restore the initial user input // We restore the initial user input
this.name = name this.name = name
}) })
this.hideModal()
}, },
hideModal() { hideModal() {
this.$data.name = undefined this.name = null
this.$emit("hide-modal") this.$emit("hide-modal")
}, },
}, },

View File

@@ -398,8 +398,8 @@ export default {
this.newMembers = [] this.newMembers = []
}, },
hideModal() { hideModal() {
this.rename = null
this.$emit("hide-modal") this.$emit("hide-modal")
this.$data.name = undefined
}, },
}, },
} }