From 1baef032e8d959236a65f6bf6e56204ebf925a5c Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Wed, 26 Feb 2025 16:35:27 +0100 Subject: [PATCH] refactor --- packages/trace-viewer/src/ui/actionList.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/trace-viewer/src/ui/actionList.tsx b/packages/trace-viewer/src/ui/actionList.tsx index 7031ff3859..bf2b0c723c 100644 --- a/packages/trace-viewer/src/ui/actionList.tsx +++ b/packages/trace-viewer/src/ui/actionList.tsx @@ -118,15 +118,12 @@ export const renderAction = ( const { errors, warnings } = modelUtil.stats(action); const showAttachments = !!action.attachments?.length && !!revealAttachment; - let apiName = action.apiName; - if (apiName === 'apiRequestContext.get') - apiName = 'GET'; - else if (apiName === 'apiRequestContext.post') - apiName = 'POST'; - else if (apiName === 'apiRequestContext.put') - apiName = 'PUT'; - else if (apiName === 'apiRequestContext.delete') - apiName = 'DELETE'; + const apiName = { + 'apiRequestContext.get': 'GET', + 'apiRequestContext.post': 'POST', + 'apiRequestContext.put': 'PUT', + 'apiRequestContext.delete': 'DELETE', + }[action.apiName] ?? action.apiName; const parameterString = actionParameterDisplayString(action, sdkLanguage || 'javascript');