Skip to content

Commit

Permalink
cleanup logic with suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner committed Jul 15, 2024
1 parent f91eff3 commit 73b0d59
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
6 changes: 2 additions & 4 deletions explorer/src/components/Operator/NominationManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,12 @@ export const NominationManagement: FC = () => {
const excludeActions = [OperatorActionType.Deregister, OperatorActionType.UnlockFunds]
if (
row.original.operator.status &&
(JSON.parse(row.original.operator.status) as unknown as { deregistered: object })
.deregistered
JSON.parse(row.original.operator.status ?? '{}')?.deregistered
)
excludeActions.push(OperatorActionType.Nominating)
if (
row.original.operator.status &&
(JSON.parse(row.original.operator.status) as unknown as { slashed: object }).slashed ===
null
JSON.parse(row.original.operator.status ?? '{}')?.slashed === null
)
return <></>
return (
Expand Down
6 changes: 2 additions & 4 deletions explorer/src/components/Operator/NominatorsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,12 @@ export const NominatorsList: FC = () => {
const excludeActions = [OperatorActionType.Deregister, OperatorActionType.UnlockFunds]
if (
row.original.operator.status &&
(JSON.parse(row.original.operator.status) as unknown as { deregistered: object })
.deregistered
JSON.parse(row.original.operator.status ?? '{}')?.deregistered
)
excludeActions.push(OperatorActionType.Nominating)
if (
row.original.operator.status &&
(JSON.parse(row.original.operator.status) as unknown as { slashed: object }).slashed ===
null
JSON.parse(row.original.operator.status ?? '{}')?.slashed === null
)
return <></>
return (
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/components/Operator/OperatorManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ export const OperatorManagement: FC = () => {
if (
!useRpcData &&
row.original.status &&
(JSON.parse(row.original.status) as unknown as { deregistered: object }).deregistered
JSON.parse(row.original.status ?? '{}')?.deregistered
)
excludeActions.push(OperatorActionType.Nominating)
if (
!useRpcData &&
row.original.status &&
(JSON.parse(row.original.status) as unknown as { slashed: object }).slashed === null
JSON.parse(row.original.status ?? '{}')?.slashed === null
)
return <></>
return (
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/components/Operator/OperatorsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ export const OperatorsList: FC = () => {
!useRpcData &&
!nominator &&
row.original.status &&
(JSON.parse(row.original.status) as unknown as { deregistered: object }).deregistered
JSON.parse(row.original.status ?? '{}')?.deregistered
)
excludeActions.push(OperatorActionType.Nominating)
if (
!useRpcData &&
row.original.status &&
(JSON.parse(row.original.status) as unknown as { slashed: object }).slashed === null
JSON.parse(row.original.status ?? '{}')?.slashed === null
)
return <></>
return (
Expand Down

0 comments on commit 73b0d59

Please sign in to comment.