blob: eba388d68e552230fd18b2ff2786da266ba0c6d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import React from 'react'
import ProjectActionButtons from '../../components/projects/ProjectActionButtons'
import { useMutation, useQueryClient } from 'react-query'
import { useAuth } from '../../auth'
import { deleteProject } from '../../api/projects'
const ProjectActions = (props) => {
const auth = useAuth()
const queryClient = useQueryClient()
const mutation = useMutation((projectId) => deleteProject(auth, projectId), {
onSuccess: () => queryClient.invalidateQueries('projects'),
})
const actions = {
onViewUsers: (id) => {}, // TODO implement user viewing
onDelete: (id) => mutation.mutate(id),
}
return <ProjectActionButtons {...props} {...actions} />
}
export default ProjectActions
|