2
0

fix: 🐛 misc

- Collaboration / Invitation type change failed
- ChoiceForm items text align left
- Webhook fails when choosing GET only
This commit is contained in:
Baptiste Arnaud
2022-03-30 10:54:31 +02:00
parent 2461dd89be
commit c7d5373127
5 changed files with 28 additions and 16 deletions

View File

@ -72,7 +72,11 @@ export const CollaborationList = () => {
const handleChangeInvitationCollabType =
(email: string) => async (type: CollaborationType) => {
if (!typebot || !isOwner) return
const { error } = await updateInvitation(typebot?.id, email, { type })
const { error } = await updateInvitation(typebot?.id, email, {
email,
typebotId: typebot.id,
type,
})
if (error) return toast({ title: error.name, description: error.message })
mutateInvitations({
invitations: (invitations ?? []).map((i) =>
@ -92,7 +96,11 @@ export const CollaborationList = () => {
const handleChangeCollaborationType =
(userId: string) => async (type: CollaborationType) => {
if (!typebot || !isOwner) return
const { error } = await updateCollaborator(typebot?.id, userId, { type })
const { error } = await updateCollaborator(typebot?.id, userId, {
userId,
type,
typebotId: typebot.id,
})
if (error) return toast({ title: error.name, description: error.message })
mutateCollaborators({
collaborators: (collaborators ?? []).map((c) =>

View File

@ -33,12 +33,12 @@ export const useCollaborators = ({
export const updateCollaborator = (
typebotId: string,
userId: string,
updates: Partial<CollaboratorsOnTypebots>
collaborator: CollaboratorsOnTypebots
) =>
sendRequest({
method: 'PUT',
url: `/api/typebots/${typebotId}/collaborators/${userId}`,
body: updates,
body: collaborator,
})
export const deleteCollaborator = (typebotId: string, userId: string) =>

View File

@ -35,17 +35,17 @@ export const sendInvitation = (
export const updateInvitation = (
typebotId: string,
userId: string,
updates: Partial<Invitation>
email: string,
invitation: Omit<Invitation, 'createdAt'>
) =>
sendRequest({
method: 'PUT',
url: `/api/typebots/${typebotId}/invitations/${userId}`,
body: updates,
url: `/api/typebots/${typebotId}/invitations/${email}`,
body: invitation,
})
export const deleteInvitation = (typebotId: string, userId: string) =>
export const deleteInvitation = (typebotId: string, email: string) =>
sendRequest({
method: 'DELETE',
url: `/api/typebots/${typebotId}/invitations/${userId}`,
url: `/api/typebots/${typebotId}/invitations/${email}`,
})