From 931042e71640b928d24f0863fe6fe79a3a13930a Mon Sep 17 00:00:00 2001 From: Rinsvent Date: Sat, 15 Apr 2023 00:18:13 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B8=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/elements/processes/index.tsx | 8 ++++---- hooks/use-token.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/elements/processes/index.tsx b/components/elements/processes/index.tsx index f79f418..28ab75d 100644 --- a/components/elements/processes/index.tsx +++ b/components/elements/processes/index.tsx @@ -281,16 +281,16 @@ export default function Processes() { } - {process.canUnlock && token?.permissions.indexOf('unlock_process') > -1 && openDialog(process, Action.Unlock)} title={`Unlock`} aria-label="Unlock"> + {process.canUnlock && token && token?.permissions.indexOf('unlock_process') > -1 && openDialog(process, Action.Unlock)} title={`Unlock`} aria-label="Unlock"> } - {process.canApprove && token?.permissions.indexOf('approve_process') > -1 && openDialog(process, Action.Approve)} title={`Approve`} aria-label="Approve"> + {process.canApprove && token && token?.permissions.indexOf('approve_process') > -1 && openDialog(process, Action.Approve)} title={`Approve`} aria-label="Approve"> } - {process.canRepeat && token?.permissions.indexOf('run_command') > -1 && openDialog(process, Action.Repeat)} title={`Repeat`} aria-label="Repeat"> + {process.canRepeat && token && token?.permissions.indexOf('run_command') > -1 && openDialog(process, Action.Repeat)} title={`Repeat`} aria-label="Repeat"> } - {process.canKill && token?.permissions.indexOf('kill_process') > -1 && openDialog(process, Action.Kill)} title={`Kill`} aria-label="Kill"> + {process.canKill && token && token?.permissions.indexOf('kill_process') > -1 && openDialog(process, Action.Kill)} title={`Kill`} aria-label="Kill"> } {process?.outputId && output(process)} aria-label="Output"> diff --git a/hooks/use-token.ts b/hooks/use-token.ts index 4940ee2..97e222d 100644 --- a/hooks/use-token.ts +++ b/hooks/use-token.ts @@ -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 () => {