()
| 76 | }, [show, dispatch]) |
| 77 | |
| 78 | const updateUser = async () => { |
| 79 | try { |
| 80 | const saveObj = { |
| 81 | userId: user.id, |
| 82 | organizationId: currentUser.activeOrganizationId, |
| 83 | status: status |
| 84 | } |
| 85 | |
| 86 | const saveResp = await userApi.updateOrganizationUser(saveObj) |
| 87 | if (saveResp.data) { |
| 88 | enqueueSnackbar({ |
| 89 | message: 'User Details Updated', |
| 90 | options: { |
| 91 | key: new Date().getTime() + Math.random(), |
| 92 | variant: 'success', |
| 93 | action: (key) => ( |
| 94 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 95 | <IconX /> |
| 96 | </Button> |
| 97 | ) |
| 98 | } |
| 99 | }) |
| 100 | onConfirm(saveResp.data.id) |
| 101 | } |
| 102 | } catch (error) { |
| 103 | setError(err) |
| 104 | enqueueSnackbar({ |
| 105 | message: `Failed to update User: ${ |
| 106 | typeof error.response.data === 'object' ? error.response.data.message : error.response.data |
| 107 | }`, |
| 108 | options: { |
| 109 | key: new Date().getTime() + Math.random(), |
| 110 | variant: 'error', |
| 111 | persist: true, |
| 112 | action: (key) => ( |
| 113 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 114 | <IconX /> |
| 115 | </Button> |
| 116 | ) |
| 117 | } |
| 118 | }) |
| 119 | onCancel() |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | const component = show ? ( |
| 124 | <Dialog |
no test coverage detected