refactor: request actions + fix: timeout bug

This commit is contained in:
Liyas Thomas
2021-05-12 05:33:15 +00:00
committed by GitHub
parent dd3b51d0b7
commit 2ff0f97295
10 changed files with 128 additions and 102 deletions

View File

@@ -124,6 +124,7 @@
@unselect-collection="$emit('remove-collection', collection)"
@expand-collection="expandCollection"
@remove-collection="removeCollection"
@remove-request="removeRequest"
/>
</li>
</ul>
@@ -595,6 +596,36 @@ export default {
}
}
},
removeRequest({ collectionIndex, folderName, requestIndex }) {
if (this.collectionsType.type == "my-collections") {
this.$store.commit("postwoman/removeRequest", {
collectionIndex: collectionIndex,
folderName: folderName,
requestIndex: requestIndex,
flag: "rest",
})
this.$toast.error(this.$t("deleted"), {
icon: "delete",
})
this.syncCollections()
} else if (this.collectionsType.type == "team-collections") {
team_utils
.deleteRequest(this.$apollo, requestIndex)
.then((data) => {
// Result
this.$toast.success(this.$t("deleted"), {
icon: "delete",
})
})
.catch((error) => {
// Error
this.$toast.error(this.$t("error_occurred"), {
icon: "done",
})
console.error(error)
})
}
},
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)