Skip to content

Commit

Permalink
Fix/current url not working (#187)
Browse files Browse the repository at this point in the history
* CHORE/todos added

* FIX/getBaseUrl
  • Loading branch information
AugustinSorel authored Jun 29, 2024
1 parent bb8c50d commit b3fc8b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { env } from "@/env.mjs";
import { clsx } from "clsx";
import type { ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
Expand Down Expand Up @@ -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}`;
};

0 comments on commit b3fc8b9

Please sign in to comment.