fix: production crash due to undefined import.meta.env by adding env utility and updating build script
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { redirect } from "@tanstack/react-router";
|
||||
import { VITE_PUBLIC_URL } from "../utils/env";
|
||||
|
||||
/* ================================
|
||||
* Types
|
||||
@@ -21,7 +22,7 @@ type SessionResponse = {
|
||||
|
||||
async function fetchSession(): Promise<SessionResponse | null> {
|
||||
try {
|
||||
const baseURL = import.meta.env.VITE_PUBLIC_URL || window.location.origin;
|
||||
const baseURL = VITE_PUBLIC_URL || window.location.origin;
|
||||
const res = await fetch(`${baseURL}/api/session`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
|
||||
Reference in New Issue
Block a user