refactor: improved input validations

This commit is contained in:
liyasthomas
2021-08-08 12:01:36 +05:30
parent fee19f3d7a
commit 4d76c83328
18 changed files with 105 additions and 68 deletions

View File

@@ -40,6 +40,10 @@ export default {
},
methods: {
addNewCollection() {
if (!this.name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.name)
this.hideModal()
},

View File

@@ -43,6 +43,10 @@ export default {
},
methods: {
addFolder() {
if (!this.name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
this.$emit("add-folder", {
name: this.name,
folder: this.folder,

View File

@@ -41,6 +41,10 @@ export default {
},
methods: {
saveCollection() {
if (!this.name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.name)
this.hideModal()
},

View File

@@ -40,6 +40,10 @@ export default {
},
methods: {
editFolder() {
if (!this.name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.name)
this.hideModal()
},

View File

@@ -43,6 +43,10 @@ export default {
},
methods: {
saveRequest() {
if (!this.requestUpdateData.name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.requestUpdateData)
this.hideModal()
},

View File

@@ -107,14 +107,14 @@ export default defineComponent({
this.picked = picked
},
saveRequestAs() {
if (this.picked == null) {
this.$toast.error(this.$t("collection.select"), {
if (!this.requestName) {
this.$toast.error(this.$t("empty_req_name"), {
icon: "error",
})
return
}
if (this.$data.requestData.name.length === 0) {
this.$toast.error(this.$t("empty_req_name"), {
if (this.picked == null) {
this.$toast.error(this.$t("collection.select"), {
icon: "error",
})
return

View File

@@ -21,8 +21,8 @@
py-2
pr-2
pl-9
focus:outline-none
truncate
focus:outline-none
"
/>
</div>
@@ -312,10 +312,6 @@ export default {
},
// Intented to be called by the CollectionAdd modal submit event
addNewRootCollection(name) {
if (!name) {
this.$toast.info(this.$t("collection.invalid_name"))
return
}
if (this.collectionsType.type === "my-collections") {
addRESTCollection({
name,