Skip to content

Commit 057b3a5

Browse files
committed
fix: better typecheck
1 parent d8b99e8 commit 057b3a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pages/api/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ const NODE_ENV = process.env.NODE_ENV
88
const API_ENDPOINT = process.env.API_ENDPOINT || 'https://pro.microlink.io'
99
const API_KEY = process.env.API_KEY
1010

11-
const origins = process.env.ORIGINS.split(',').map(n => n.trim())
11+
const origins = process.env.ORIGINS?.split(',').map(n => n.trim())
12+
1213
const isProduction = NODE_ENV === 'production'
1314

1415
const isAllowedDomain =
15-
isProduction && origins.length > 0
16+
isProduction && Array.isArray(origins)
1617
? origin => origins.includes(origin)
1718
: () => true
1819

0 commit comments

Comments
 (0)