Skip to content

Commit

Permalink
fix: update success message
Browse files Browse the repository at this point in the history
  • Loading branch information
b3aton committed Jan 31, 2023
1 parent dac7446 commit c5e77d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/storefront/src/pages/usermanagement/AddEditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ const AddEditUser = ({
handleSubmit(async (data) => {
setAddUpdateLoading(true)

let message = 'add user successfully'

try {
const params: Partial<filterProps> = {
companyId,
Expand All @@ -152,15 +154,22 @@ const AddEditUser = ({
if (userType === 7) {
params.addChannel = true
}

if (userType === 7) {
message = `user detected in your company, we will allow current storefront access for email: ${data.email}`
}
}

if (type === 'edit') {
params.userId = editData?.id || ''
message = 'update user successfully'
delete params.email
}
await addOrUpdateUsers(params)
handleCancelClick()
snackbar.success(`${type === 'edit' ? 'update user successfully' : 'add user successfully'}`)

snackbar.success(message)

renderList()
} finally {
setAddUpdateLoading(false)
Expand Down

0 comments on commit c5e77d7

Please sign in to comment.