Skip to content

Commit

Permalink
fix: addEditUser btn create
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-liu-smile committed May 15, 2023
1 parent 09d5d61 commit 5b83cbf
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/storefront/src/pages/usermanagement/AddEditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useB3Lang } from '@b3/lang'
import { B3CustomForm, B3Dialog } from '@/components'
import { GlobaledContext } from '@/shared/global'
import { addOrUpdateUsers, checkUserEmail } from '@/shared/service/b2b'
import { B3SStorage, snackbar } from '@/utils'
import { snackbar } from '@/utils'

import {
emailError,
Expand All @@ -32,7 +32,7 @@ function AddEditUser(
ref: Ref<unknown> | undefined
) {
const {
state: { currentChannelId },
state: { currentChannelId, B3UserId },
} = useContext(GlobaledContext)

const [open, setOpen] = useState<boolean>(false)
Expand Down Expand Up @@ -151,11 +151,14 @@ function AddEditUser(
}

const handleOpenAddEditUserClick = (type: string, data: UsersList) => {
const currentUserId = B3SStorage.get('B3UserId')
const disabledUserRole = +data.id === +currentUserId
const usersFiles = getUsersFiles(type, disabledUserRole)
if (type === 'edit') {
setEditData(data)
}
const usersFiles = getUsersFiles(
type,
type === 'edit' ? +B3UserId === +data.id : false
)
setUsersFiles(usersFiles)
setEditData(data)
setType(type)
setOpen(true)
}
Expand Down

0 comments on commit 5b83cbf

Please sign in to comment.