Update environment api route

This commit is contained in:
Moritz Utcke
2024-11-04 17:13:28 +11:00
parent 36ceef2729
commit d9f9f1df34
3 changed files with 11 additions and 4 deletions

View File

@@ -14,4 +14,4 @@ api:
all:
mkdir -p logs
bun run dev 2>&1 | tee logs/`date '+%d-%m-%Y_%H:%M:%S'`.log
bun run dev 2>&1 | tee ~/logs/`date '+%d-%m-%Y_%H:%M:%S'`.log

View File

@@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "bun astro dev",
"build": "bun --bun astro build",
"preview": "bun --bun astro preview",
"build": "bun astro build",
"preview": "bun astro preview",
"astro": "astro",
"test:e2e": "cypress run",
"test:unit": "bun test",

View File

@@ -3,10 +3,17 @@ import cookies from 'js-cookie';
import type { AppRouter } from '@ibcornelsen/api';
import { Buffer } from 'buffer';
let url: string = 'http://localhost:3001/';
if (process.env.ENVIRONMENT === "remote") {
url = "http://api.ibcornelsen.de/"
}
export const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3001/',
url,
headers() {
const accessToken = cookies.get('accessToken');
if (!accessToken) return {};