Поправил типы

jwt
Rinsvent 2 years ago
parent 5f59bbe18f
commit 931042e716
  1. 8
      components/elements/processes/index.tsx
  2. 4
      hooks/use-token.ts

@ -281,16 +281,16 @@ export default function Processes() {
</IconButton>}
</TableCell>
<TableCell>
{process.canUnlock && token?.permissions.indexOf('unlock_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Unlock)} title={`Unlock`} aria-label="Unlock">
{process.canUnlock && token && token?.permissions.indexOf('unlock_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Unlock)} title={`Unlock`} aria-label="Unlock">
<LockOpenOutlined/>
</IconButton>}
{process.canApprove && token?.permissions.indexOf('approve_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Approve)} title={`Approve`} aria-label="Approve">
{process.canApprove && token && token?.permissions.indexOf('approve_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Approve)} title={`Approve`} aria-label="Approve">
<ThumbUpAltOutlined/>
</IconButton>}
{process.canRepeat && token?.permissions.indexOf('run_command') > -1 && <IconButton onClick={() => openDialog(process, Action.Repeat)} title={`Repeat`} aria-label="Repeat">
{process.canRepeat && token && token?.permissions.indexOf('run_command') > -1 && <IconButton onClick={() => openDialog(process, Action.Repeat)} title={`Repeat`} aria-label="Repeat">
<ReplayOutlined/>
</IconButton>}
{process.canKill && token?.permissions.indexOf('kill_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Kill)} title={`Kill`} aria-label="Kill">
{process.canKill && token && token?.permissions.indexOf('kill_process') > -1 && <IconButton onClick={() => openDialog(process, Action.Kill)} title={`Kill`} aria-label="Kill">
<DeleteForeverOutlined/>
</IconButton>}
{process?.outputId && <IconButton title={`Output`} onClick={() => output(process)} aria-label="Output">

@ -12,7 +12,7 @@ export interface UseTokenInterface {
tokens: Token[]
switchToken(tokenId: string): void
deleteToken(tokenId: string): void
addToken(tokenId: string): void
addToken(tokenId: string): boolean
}
export function useToken(): UseTokenInterface {
@ -21,7 +21,7 @@ export function useToken(): UseTokenInterface {
useEffect(() => {
setToken(grabToken()?.payload)
let tokens = grabTokens().map((tokenData) => tokenData.payload)
let tokens = grabTokens().map((tokenData) => tokenData.payload as Token)
setTokens(tokens)
return () => {

Loading…
Cancel
Save