Skip to content

Commit

Permalink
chore(landing): use docker addr for requests to api on backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Aug 16, 2023
1 parent 3e2646b commit b37db81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/landing/src/api/twirp.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport';
import { ProtectedClient, UnProtectedClient } from '@twir/grpc/generated/api/api.client';


const host = process.env.HOSTNAME;
const baseUrl = `${host?.startsWith('localhost') ? 'http' : 'https'}://${host}/api/v1`;
const isDev = process.env.NODE_ENV === 'development';
const baseUrl = `${host?.startsWith('localhost') ? 'http' : 'https'}://${isDev ? host : 'api'}/api/v1`;

const transport = new TwirpFetchTransport({
baseUrl,
sendJson: process.env.NODE_ENV === 'development',
baseUrl,
sendJson: isDev,
});

export const protectedClient = new ProtectedClient(transport);
Expand Down
2 changes: 1 addition & 1 deletion frontend/landing/src/components/index/StatsList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { unProtectedClient } from '../../api/twirp.js';
let res: Response | undefined;
try {
const { response } = await unProtectedClient.getStats({}, { timeout: 5000 });
const { response } = await unProtectedClient.getStats({}, { timeout: 1000 });
res = response;
} catch { /* ignore error */
}
Expand Down

0 comments on commit b37db81

Please sign in to comment.