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 () => {