Skip to content

Commit 46a338b

Browse files
committed
Clean
1 parent bfee7ff commit 46a338b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

common/src/api/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {BACKEND_DOMAIN} from 'common/envs/constants'
1+
import {BACKEND_DOMAIN, IS_LOCAL} from 'common/envs/constants'
22

33
type ErrorCode =
44
| 400 // your input is bad (like zod is mad)
@@ -27,12 +27,11 @@ export function pathWithPrefix(path: string) {
2727
}
2828

2929
export function getWebsocketUrl() {
30-
const protocol = BACKEND_DOMAIN.startsWith('localhost') ? 'ws' : 'wss'
31-
30+
const protocol = IS_LOCAL ? 'ws' : 'wss'
3231
return `${protocol}://${BACKEND_DOMAIN}/ws`
3332
}
3433

3534
export function getApiUrl(path: string) {
36-
const protocol = BACKEND_DOMAIN.startsWith('localhost') ? 'http' : 'https'
35+
const protocol = IS_LOCAL ? 'http' : 'https'
3736
return `${protocol}://${BACKEND_DOMAIN}/${prefix}/${path}`
3837
}

0 commit comments

Comments
 (0)