From 196910a706290b897e4a88daa3b17af7cde242db Mon Sep 17 00:00:00 2001 From: Alexander Midteide <144693023+alexdigdir@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:08:58 +0200 Subject: [PATCH] fix: GUI action links now opens in new window as a link instead of doing a GET fetch (#1024) --- packages/frontend/src/api/useDialogById.tsx | 2 +- packages/frontend/src/components/InboxItem/GuiActions.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/api/useDialogById.tsx b/packages/frontend/src/api/useDialogById.tsx index 506bf3d5d..7064678aa 100644 --- a/packages/frontend/src/api/useDialogById.tsx +++ b/packages/frontend/src/api/useDialogById.tsx @@ -137,7 +137,7 @@ export function mapDialogDtoToInboxItem( url: guiAction.url, hidden: !guiAction.isAuthorized, priority: guiAction.priority, - httpMethod: guiAction.action, + httpMethod: guiAction.httpMethod, title: getPropertyByCultureCode(guiAction.title), prompt: getPropertyByCultureCode(guiAction.prompt), isDeleteAction: guiAction.isDeleteDialogAction, diff --git a/packages/frontend/src/components/InboxItem/GuiActions.tsx b/packages/frontend/src/components/InboxItem/GuiActions.tsx index 1bdf73e3b..4d0e33b61 100644 --- a/packages/frontend/src/components/InboxItem/GuiActions.tsx +++ b/packages/frontend/src/components/InboxItem/GuiActions.tsx @@ -13,7 +13,7 @@ export interface GuiActionButtonProps { url: string; priority: GuiActionPriority; isDeleteAction: boolean; - httpMethod: string; + httpMethod: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT'; title: string; prompt?: string; disabled?: boolean; @@ -40,7 +40,7 @@ const handleButtonClick = async (props: GuiActionButtonProps, dialogToken: strin } if (httpMethod === 'GET') { - window.location.href = url; + window.open(url, '_blank'); } else { try { const response = await fetch(url, {