@@ -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 {
@@ -135,9 +136,9 @@ export const useNotifications = (colors: boolean): NotificationsState => {
135
136
) {
136
137
return notification ;
137
138
}
138
- const isEnterprise =
139
- accountNotifications . hostname !==
140
- Constants . DEFAULT_AUTH_OPTIONS . hostname ;
139
+ const isEnterprise = isEnterpriseHost (
140
+ accountNotifications . hostname ,
141
+ ) ;
141
142
const token = isEnterprise
142
143
? getEnterpriseAccountToken (
143
144
accountNotifications . hostname ,
@@ -197,7 +198,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
197
198
async ( accounts , id , hostname ) => {
198
199
setIsFetching ( true ) ;
199
200
200
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
201
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
201
202
const token = isEnterprise
202
203
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
203
204
: accounts . token ;
@@ -230,7 +231,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
230
231
async ( accounts , id , hostname ) => {
231
232
setIsFetching ( true ) ;
232
233
233
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
234
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
234
235
const token = isEnterprise
235
236
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
236
237
: accounts . token ;
@@ -263,7 +264,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
263
264
async ( accounts , id , hostname ) => {
264
265
setIsFetching ( true ) ;
265
266
266
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
267
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
267
268
const token = isEnterprise
268
269
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
269
270
: accounts . token ;
@@ -289,7 +290,7 @@ export const useNotifications = (colors: boolean): NotificationsState => {
289
290
async ( accounts , repoSlug , hostname ) => {
290
291
setIsFetching ( true ) ;
291
292
292
- const isEnterprise = hostname !== Constants . DEFAULT_AUTH_OPTIONS . hostname ;
293
+ const isEnterprise = isEnterpriseHost ( hostname ) ;
293
294
const token = isEnterprise
294
295
? getEnterpriseAccountToken ( hostname , accounts . enterpriseAccounts )
295
296
: accounts . token ;
0 commit comments