From 9150830aa4f35e855b26c18d71d4cbba440f8e47 Mon Sep 17 00:00:00 2001 From: Naoki Kishi Date: Wed, 18 Oct 2023 22:09:04 +0900 Subject: [PATCH] fix: use enterprise token if hostname of notification is enterprise server (#669) --- src/hooks/useNotifications.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hooks/useNotifications.ts b/src/hooks/useNotifications.ts index 1aaa286a..50cf161b 100644 --- a/src/hooks/useNotifications.ts +++ b/src/hooks/useNotifications.ts @@ -124,12 +124,21 @@ export const useNotifications = (colors: boolean): NotificationsState => { ) { return notification; } + const isEnterprise = + accountNotifications.hostname !== + Constants.DEFAULT_AUTH_OPTIONS.hostname; + const token = isEnterprise + ? getEnterpriseAccountToken( + accountNotifications.hostname, + accounts.enterpriseAccounts, + ) + : accounts.token; const cardinalData = ( await apiRequestAuth( notification.subject.url, 'GET', - accounts.token, + token, ) ).data;