feat: init backend for drag and drop requests on team collections - fixed #2005
This commit is contained in:
@@ -187,6 +187,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from "@nuxtjs/composition-api"
|
import { defineComponent } from "@nuxtjs/composition-api"
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import { moveRESTTeamRequest } from "~/helpers/backend/mutations/TeamRequest"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -258,11 +260,15 @@ export default defineComponent({
|
|||||||
expandCollection(collectionID) {
|
expandCollection(collectionID) {
|
||||||
this.$emit("expand-collection", collectionID)
|
this.$emit("expand-collection", collectionID)
|
||||||
},
|
},
|
||||||
dropEvent({ dataTransfer }) {
|
async dropEvent({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
const requestIndex = dataTransfer.getData("requestIndex")
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
console.log(requestIndex, this.collection.id)
|
const moveRequestResult = await moveRESTTeamRequest(
|
||||||
// moveRESTTeamRequest(`${this.collectionIndex}`, requestIndex)
|
requestIndex,
|
||||||
|
this.collection.id
|
||||||
|
)()
|
||||||
|
if (E.isLeft(moveRequestResult))
|
||||||
|
this.$toast.error(this.$t("error.something_went_wrong"))
|
||||||
},
|
},
|
||||||
removeRequest({ collectionIndex, folderName, requestIndex }) {
|
removeRequest({ collectionIndex, folderName, requestIndex }) {
|
||||||
this.$emit("remove-request", {
|
this.$emit("remove-request", {
|
||||||
|
|||||||
@@ -166,6 +166,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from "@nuxtjs/composition-api"
|
import { defineComponent } from "@nuxtjs/composition-api"
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import { moveRESTTeamRequest } from "~/helpers/backend/mutations/TeamRequest"
|
||||||
import * as teamUtils from "~/helpers/teams/utils"
|
import * as teamUtils from "~/helpers/teams/utils"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -245,11 +247,15 @@ export default defineComponent({
|
|||||||
expandCollection(collectionID) {
|
expandCollection(collectionID) {
|
||||||
this.$emit("expand-collection", collectionID)
|
this.$emit("expand-collection", collectionID)
|
||||||
},
|
},
|
||||||
dropEvent({ dataTransfer }) {
|
async dropEvent({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
const requestIndex = dataTransfer.getData("requestIndex")
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
console.log(requestIndex, this.folder.id)
|
const moveRequestResult = await moveRESTTeamRequest(
|
||||||
// moveRESTTeamRequest(this.folder.id, requestIndex)
|
requestIndex,
|
||||||
|
this.folder.id
|
||||||
|
)()
|
||||||
|
if (E.isLeft(moveRequestResult))
|
||||||
|
this.$toast.error(this.$t("error.something_went_wrong"))
|
||||||
},
|
},
|
||||||
removeRequest({ collectionIndex, folderName, requestIndex }) {
|
removeRequest({ collectionIndex, folderName, requestIndex }) {
|
||||||
this.$emit("remove-request", {
|
this.$emit("remove-request", {
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ export default defineComponent({
|
|||||||
dragStart({ dataTransfer }) {
|
dragStart({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
dataTransfer.setData("requestIndex", this.requestIndex)
|
dataTransfer.setData("requestIndex", this.requestIndex)
|
||||||
console.log(dataTransfer)
|
|
||||||
},
|
},
|
||||||
removeRequest() {
|
removeRequest() {
|
||||||
this.$emit("remove-request", {
|
this.$emit("remove-request", {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
mutation MoveRESTTeamRequest($requestID: ID!, $collectionID: ID!) {
|
||||||
|
moveRequest(requestID: $requestID, destCollID: $collectionID) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { runMutation } from "../GQLClient"
|
||||||
|
import {
|
||||||
|
MoveRestTeamRequestDocument,
|
||||||
|
MoveRestTeamRequestMutation,
|
||||||
|
MoveRestTeamRequestMutationVariables,
|
||||||
|
} from "../graphql"
|
||||||
|
|
||||||
|
type MoveRestTeamRequestErrors =
|
||||||
|
| "team_req/not_found"
|
||||||
|
| "team_req/invalid_target_id"
|
||||||
|
|
||||||
|
export const moveRESTTeamRequest = (requestID: string, collectionID: string) =>
|
||||||
|
runMutation<
|
||||||
|
MoveRestTeamRequestMutation,
|
||||||
|
MoveRestTeamRequestMutationVariables,
|
||||||
|
MoveRestTeamRequestErrors
|
||||||
|
>(MoveRestTeamRequestDocument, {
|
||||||
|
requestID,
|
||||||
|
collectionID,
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user