useAddTeam
Overview
useAddTeam is a hook used to add/create a new team into a project.
Usage
const Component = () => {
const [err, setErr] = useState("")
const { data: project } = useProjectSession()
const team = {
name: '',
owner: '',
members: []
}
const addTeam = useAddTeam({projectId: project._id})
addTeam.mutate(
{ ...team, project: project._id },
{
onSuccess: (res) => {
if (res.err) setErr(err.message)
}
}
)
}
Parameters
projectId
[ String ]: Id of the project that the new team will be in. It is used to update react-query key.
Returns
addTeamMutation
: A react-query mutation function used to add a new team.