fix: drag and drop on collections

This commit is contained in:
Andrew Bastin
2021-05-28 00:23:11 -04:00
parent 70a350fdac
commit 66bb9dc42b
4 changed files with 15 additions and 82 deletions

View File

@@ -163,8 +163,7 @@
</template>
<script>
import { fb } from "~/helpers/fb"
import { getSettingSubject } from "~/newstore/settings"
import { moveRESTRequest } from "~/newstore/collections"
export default {
props: {
@@ -188,11 +187,6 @@ export default {
pageNo: 0,
}
},
subscriptions() {
return {
SYNC_COLLECTIONS: getSettingSubject("syncCollections"),
}
},
computed: {
isSelected() {
return (
@@ -206,14 +200,6 @@ export default {
editRequest(event) {
this.$emit("edit-request", event)
},
syncCollections() {
if (fb.currentUser !== null && this.SYNC_COLLECTIONS) {
fb.writeCollections(
JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)),
"collections"
)
}
},
toggleShowChildren() {
if (this.$props.saveRequest)
this.$emit("select", {
@@ -236,22 +222,9 @@ export default {
},
dropEvent({ dataTransfer }) {
this.dragging = !this.dragging
const oldCollectionIndex = dataTransfer.getData("oldCollectionIndex")
const oldFolderIndex = dataTransfer.getData("oldFolderIndex")
const oldFolderName = dataTransfer.getData("oldFolderName")
const folderPath = dataTransfer.getData("folderPath")
const requestIndex = dataTransfer.getData("requestIndex")
const flag = "rest"
this.$store.commit("postwoman/moveRequest", {
oldCollectionIndex,
newCollectionIndex: this.$props.collectionIndex,
newFolderIndex: -1,
newFolderName: this.$props.collection.name,
oldFolderIndex,
oldFolderName,
requestIndex,
flag,
})
this.syncCollections()
moveRESTRequest(folderPath, requestIndex, this.collectionIndex.toString())
},
},
}