refactor: improved input validations
This commit is contained in:
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user