Skip to main content

useUpdateTeam


Overview

useUpdateTeam is a hook used to update an existing team inside a project.

Usage

const Component = () => {
const [err, setErr] = useState("")

const { data: project } = useProjectSession()

const team = {
teamId: '662e760532df26ab0c1bf72a'
name: 'example',
owner: '662e75cfe1570dec49e3faa6',
members: ['662e75da10664e8773e8fc8e','662e75e379f97b8bf9795316']
}

const updateTeam = useUpdateTeam({projectId: project._id})

updateTeam.mutate(
{ ...team },
{
onSuccess: (res) => {
if (res.err) setErr(err.message)
}
}
)
}

Parameters

  • projectId [ String ]: Id of the project that the existing project is in. It is used to update react-query key.

Returns

  • updateTeamMutation: A react-query mutation function used to update an existing team.