From b3fc8b92ea1c5855861e06837f69b9160a0e87ad Mon Sep 17 00:00:00 2001 From: Augustin <48162609+AugustinSorel@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:45:26 +0100 Subject: [PATCH] Fix/current url not working (#187) * CHORE/todos added * FIX/getBaseUrl --- src/app/page.tsx | 3 +++ src/lib/utils.ts | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 235a62d8..d17e1523 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -463,6 +463,9 @@ const FeaturesGridBackground = () => { }; //TODO: leaving team +//TODO: renaming team +//TODO: deleting team +//TODO: add random facts to team page eg heavier lifter or most active in team //TODO: update header ui //TODO: add teams feat in main page //TODO: better sign in and join team email diff --git a/src/lib/utils.ts b/src/lib/utils.ts index e917dde7..6e687f84 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,3 +1,4 @@ +import { env } from "@/env.mjs"; import { clsx } from "clsx"; import type { ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; @@ -30,7 +31,19 @@ export const pluralize = ({ count, noun, suffix = "s" }: PluralizeProps) => { }; export const getBaseUrl = () => { - if (typeof window !== "undefined") return window.location.origin; - if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; + if (env.NODE_ENV === "production") { + return `https://gym-graphs.vercel.app`; + } + + if (typeof window !== "undefined") { + return window.location.origin; + } + + //TODO: add this to the env obj + if (process.env.VERCEL_URL) { + return `https://${process.env.VERCEL_URL}`; + } + + //TODO: add this to the env obj return `http://localhost:${process.env.PORT ?? 3000}`; };