Skip to content

Commit

Permalink
feat(user) refactored workspaces in roles and user so they can share …
Browse files Browse the repository at this point in the history
…table component
  • Loading branch information
sholzer committed Jan 20, 2025
1 parent f00390f commit acfb548
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ const WorkspacesContainer = ({ ...props }): React.JSX.Element => {
const { id } = useUserContext()
const { user, isLoading, changeUserInState } = useUserDraft(id)

if (user === undefined) {
return <></>
}

const [assetWorkspaces, setAssetWorkspaces] = React.useState<UserWorkspace[]>(user?.assetWorkspaces ?? [])
const [documentWorkspaces, setDocumentWorkspaces] = React.useState<UserWorkspace[]>(user?.documentWorkspaces ?? [])
const [objectWorkspaces, setObjectWorkspaces] = React.useState<UserWorkspace[]>(user?.dataObjectWorkspaces ?? [])
Expand All @@ -45,6 +41,10 @@ const WorkspacesContainer = ({ ...props }): React.JSX.Element => {
type: 'error'
})

if (user === undefined) {
return <></>
}

const documentsAccordion = [
{
key: '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ const WorkspacesContainer = ({ ...props }): React.JSX.Element => {
const { id } = useRoleContext()
const { item, isLoading, changeItemInState } = useRoleDraft(id)

if (item === undefined) {
return <></>
}

const [assetWorkspaces, setAssetWorkspaces] = React.useState<UserWorkspace[]>(item?.assetWorkspaces ?? [])
const [documentWorkspaces, setDocumentWorkspaces] = React.useState<UserWorkspace[]>(item?.documentWorkspaces ?? [])
const [objectWorkspaces, setObjectWorkspaces] = React.useState<UserWorkspace[]>(item?.dataObjectWorkspaces ?? [])
Expand All @@ -45,6 +41,10 @@ const WorkspacesContainer = ({ ...props }): React.JSX.Element => {
type: 'error'
})

if (item === undefined) {
return <></>
}

const documentsAccordion = [
{
key: '1',
Expand Down

0 comments on commit acfb548

Please sign in to comment.