We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6184e81 commit a03431cCopy full SHA for a03431c
src/api.ts
@@ -4,12 +4,18 @@ import { CatClient, type CancelablePromise } from 'ccat-api'
4
5
const { DEV } = import.meta.env
6
7
+const getPort = () => {
8
+ if (DEV) return 1865
9
+ if (window.location.port == '443' || window.location.port == '80') return undefined
10
+ return parseInt(window.location.port)
11
+}
12
+
13
/**
14
* API client to make requests to the endpoints and passing the API_KEY for authentication.
15
*/
16
export const apiClient = new CatClient({
17
baseUrl: window.location.hostname,
- port: parseInt((DEV ? '1865' : window.location.port) ?? '80'),
18
+ port: getPort(),
19
secure: window.location.protocol === 'https:',
20
timeout: 15000,
21
ws: {
0 commit comments