From d9f9f1df343c01be8489905eb1d37e9324107461 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Mon, 4 Nov 2024 17:13:28 +1100 Subject: [PATCH] Update environment api route --- Makefile | 2 +- package.json | 4 ++-- src/trpc.ts | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e04b67af..a2556fd8 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/package.json b/package.json index 368213ec..e16fe4e7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/trpc.ts b/src/trpc.ts index 59949437..9902f1c5 100644 --- a/src/trpc.ts +++ b/src/trpc.ts @@ -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({ links: [ httpBatchLink({ - url: 'http://localhost:3001/', + url, headers() { const accessToken = cookies.get('accessToken'); if (!accessToken) return {};