@@ -8,6 +8,7 @@ import { apiRequestAuth } from '../utils/api-requests';
8
8
import {
9
9
getEnterpriseAccountToken ,
10
10
generateGitHubAPIUrl ,
11
+ isEnterpriseHost ,
11
12
} from '../utils/helpers' ;
12
13
import { removeNotification } from '../utils/remove-notification' ;
13
14
import {
@@ -130,9 +131,9 @@ export const useNotifications = (colors: boolean): NotificationsState => {
130
131
) {
131
132
return notification ;
132
133
}
133
- const isEnterprise =
134
- accountNotifications . hostname !==
135
- Constants . DEFAULT_AUTH_OPTIONS . hostname ;
134
+ const isEnterprise = isEnterpriseHost (
135
+ accountNotifications . hostname ,
136
+ ) ;
136
137
const token = isEnterprise
137
138
? getEnterpriseAccountToken (
138
139
accountNotifications . hostname ,
@@ -192,7 +193,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
192
193
async ( accounts , id , hostname ) => {
193
194
setIsFetching ( true ) ;
194
195
195
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
196
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
196
197
const token = isEnterprise
197
198
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
198
199
: accounts . token ;
@@ -225,7 +226,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
225
226
async ( accounts , id , hostname ) => {
226
227
setIsFetching ( true ) ;
227
228
228
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
229
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
229
230
const token = isEnterprise
230
231
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
231
232
: accounts . token ;
@@ -258,7 +259,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
258
259
async ( accounts , id , hostname ) => {
259
260
setIsFetching ( true ) ;
260
261
261
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
262
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
262
263
const token = isEnterprise
263
264
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
264
265
: accounts . token ;
@@ -284,7 +285,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
284
285
async ( accounts , repoSlug , hostname ) => {
285
286
setIsFetching ( true ) ;
286
287
287
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
288
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
288
289
const token = isEnterprise
289
290
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
290
291
: accounts . token ;
0 commit comments