mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Delete button sends call to Adminresolver deletePendingCreation.
This commit is contained in:
parent
b47bf3d41d
commit
48b7c9a0af
7
admin/src/graphql/deletePendingCreation.js
Normal file
7
admin/src/graphql/deletePendingCreation.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const deletePendingCreation = gql`
|
||||||
|
mutation ($id: Float!) {
|
||||||
|
deletePendingCreation(id: $id)
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -12,6 +12,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import UserTable from '../components/UserTable.vue'
|
import UserTable from '../components/UserTable.vue'
|
||||||
import { getPendingCreations } from '../graphql/getPendingCreations'
|
import { getPendingCreations } from '../graphql/getPendingCreations'
|
||||||
|
import { deletePendingCreation } from '../graphql/deletePendingCreation'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CreationConfirm',
|
name: 'CreationConfirm',
|
||||||
@ -57,11 +58,23 @@ export default {
|
|||||||
|
|
||||||
findArr = this.confirmResult.find((arr) => arr.id === e.id)
|
findArr = this.confirmResult.find((arr) => arr.id === e.id)
|
||||||
|
|
||||||
index = this.confirmResult.indexOf(findArr)
|
// console.log('findArr', findArr)
|
||||||
|
this.$apollo
|
||||||
this.confirmResult.splice(index, 1)
|
.mutate({
|
||||||
|
mutation: deletePendingCreation,
|
||||||
this.$store.commit('openCreationsMinus', 1)
|
variables: {
|
||||||
|
id: findArr.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
index = this.confirmResult.indexOf(findArr)
|
||||||
|
this.confirmResult.splice(index, 1)
|
||||||
|
this.$store.commit('openCreationsMinus', 1)
|
||||||
|
this.$toasted.success('Pending Creation has been deleted')
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$toasted.error(error.message)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPendingCreations() {
|
getPendingCreations() {
|
||||||
|
|||||||
@ -130,9 +130,8 @@ export class AdminResolver {
|
|||||||
@Mutation(() => Boolean)
|
@Mutation(() => Boolean)
|
||||||
async deletePendingCreation(@Arg('id') id: number): Promise<boolean> {
|
async deletePendingCreation(@Arg('id') id: number): Promise<boolean> {
|
||||||
const pendingCreationRepository = getCustomRepository(PendingCreationRepository)
|
const pendingCreationRepository = getCustomRepository(PendingCreationRepository)
|
||||||
const entity = await pendingCreationRepository.findOne(id)
|
const entity = await pendingCreationRepository.findOneOrFail(id)
|
||||||
if (!entity) throw new Error('Not pending creation with this id.')
|
const res = await pendingCreationRepository.delete(entity)
|
||||||
const res = await pendingCreationRepository.manager.remove(entity)
|
|
||||||
return !!res
|
return !!res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user