(user)
| 311 | } |
| 312 | |
| 313 | const deleteUser = async (user) => { |
| 314 | const confirmPayload = { |
| 315 | title: `Delete`, |
| 316 | description: `Remove ${user.name ?? user.email} from organization?`, |
| 317 | confirmButtonName: 'Delete', |
| 318 | cancelButtonName: 'Cancel' |
| 319 | } |
| 320 | const isConfirmed = await confirm(confirmPayload) |
| 321 | |
| 322 | if (isConfirmed) { |
| 323 | try { |
| 324 | setDeletingUserId(user.id) |
| 325 | const deleteResp = await userApi.deleteOrganizationUser(currentUser.activeOrganizationId, user.id) |
| 326 | if (deleteResp.data) { |
| 327 | enqueueSnackbar({ |
| 328 | message: 'User removed from organization successfully', |
| 329 | options: { |
| 330 | key: new Date().getTime() + Math.random(), |
| 331 | variant: 'success', |
| 332 | action: (key) => ( |
| 333 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 334 | <IconX /> |
| 335 | </Button> |
| 336 | ) |
| 337 | } |
| 338 | }) |
| 339 | onConfirm() |
| 340 | } |
| 341 | } catch (error) { |
| 342 | enqueueSnackbar({ |
| 343 | message: `Failed to delete User: ${ |
| 344 | typeof error.response.data === 'object' ? error.response.data.message : error.response.data |
| 345 | }`, |
| 346 | options: { |
| 347 | key: new Date().getTime() + Math.random(), |
| 348 | variant: 'error', |
| 349 | persist: true, |
| 350 | action: (key) => ( |
| 351 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 352 | <IconX /> |
| 353 | </Button> |
| 354 | ) |
| 355 | } |
| 356 | }) |
| 357 | } finally { |
| 358 | setDeletingUserId(null) |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | const onConfirm = () => { |
| 364 | setShowInviteDialog(false) |
nothing calls this directly
no test coverage detected