mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:15 +01:00
Slight refactor to copy-as-curl
This commit is contained in:
@@ -608,7 +608,7 @@ const SidebarItem = forwardRef(function SidebarItem(
|
||||
const deleteRequest = useDeleteRequest(activeRequest ?? null);
|
||||
const duplicateHttpRequest = useDuplicateHttpRequest({ id: itemId, navigateAfter: true });
|
||||
const duplicateGrpcRequest = useDuplicateGrpcRequest({ id: itemId, navigateAfter: true });
|
||||
const copyAsCurl = useCopyAsCurl(itemId);
|
||||
const [isCopied, copyAsCurl] = useCopyAsCurl(itemId);
|
||||
const sendRequest = useSendRequest(itemId);
|
||||
const sendManyRequests = useSendManyRequests();
|
||||
const latestHttpResponse = useLatestHttpResponse(itemId);
|
||||
@@ -739,10 +739,13 @@ const SidebarItem = forwardRef(function SidebarItem(
|
||||
{
|
||||
key: 'copyCurl',
|
||||
label: 'Copy as Curl',
|
||||
leftSlot: <Icon icon="copy" />,
|
||||
onSelect: async () => {
|
||||
await copyAsCurl.mutateAsync();
|
||||
},
|
||||
leftSlot: (
|
||||
<Icon
|
||||
className={isCopied ? 'text-green-500' : undefined}
|
||||
icon={isCopied ? 'check' : 'copy'}
|
||||
/>
|
||||
),
|
||||
onSelect: copyAsCurl,
|
||||
},
|
||||
{ type: 'separator' },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user