From e7826114c96bb588f090684dc3f07dc5b771451c Mon Sep 17 00:00:00 2001 From: miguelaenlle Date: Sun, 22 Feb 2026 16:37:07 -0600 Subject: [PATCH 1/4] Implemented env variables --- next.config.js | 6 +++++- util/api.ts | 3 ++- util/env.ts | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 util/env.ts diff --git a/next.config.js b/next.config.js index 658404ac..7054ec5d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,8 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + env: { + VITE_BASE_API_URL: process.env.VITE_BASE_API_URL + } +}; module.exports = nextConfig; diff --git a/util/api.ts b/util/api.ts index 795ea489..a48c273c 100644 --- a/util/api.ts +++ b/util/api.ts @@ -1,3 +1,4 @@ +import { getEnv } from "./env"; import { handleError } from "./helpers"; import { AcceptAdmissionRSVPRequest, @@ -11,7 +12,7 @@ import { EventType } from "./types"; -const APIv2 = "https://adonix.hackillinois.org"; +const APIv2 = getEnv("VITE_BASE_API_URL"); export const isAuthenticated = async (): Promise => { return (await getAuthToken()) !== null; diff --git a/util/env.ts b/util/env.ts new file mode 100644 index 00000000..86da6e4b --- /dev/null +++ b/util/env.ts @@ -0,0 +1,18 @@ +/** + * Type-safe environment variable access. + * Add new env variables to the `envVars` object below and to `next.config.js`'s `env` option. + */ + +const envVars = { + VITE_BASE_API_URL: process.env.VITE_BASE_API_URL +} as const; + +type EnvKey = keyof typeof envVars; + +export function getEnv(key: EnvKey): string { + const value = envVars[key]; + if (!value) { + throw new Error(`Missing required environment variable: ${key}`); + } + return value; +} From 83cbca35f5df79c16528d5a957c0e51efdfc632d Mon Sep 17 00:00:00 2001 From: miguelaenlle Date: Wed, 25 Feb 2026 15:45:20 -0600 Subject: [PATCH 2/4] Add wrangler --- wrangler.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrangler.json b/wrangler.json index d9771a3e..6d476e03 100644 --- a/wrangler.json +++ b/wrangler.json @@ -7,5 +7,8 @@ "assets": { "directory": ".open-next/assets", "binding": "ASSETS" + }, + "vars": { + "VITE_BASE_API_URL": "https://adonix.hackillinois.org" } } From fe3a314bd2c26fb2a9a3849d88b02463ad8609ff Mon Sep 17 00:00:00 2001 From: miguelaenlle Date: Wed, 25 Feb 2026 16:13:40 -0600 Subject: [PATCH 3/4] rerun --- app/register/general/GeneralRegistration.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/register/general/GeneralRegistration.tsx b/app/register/general/GeneralRegistration.tsx index 803978d0..bdfb7be0 100644 --- a/app/register/general/GeneralRegistration.tsx +++ b/app/register/general/GeneralRegistration.tsx @@ -48,7 +48,7 @@ export const GeneralRegistration = () => { const [showClickOffAlert, setShowClickOffAlert] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const [isSaving, setIsSaving] = useState(false); - const saveTimeoutRef = useRef(null); // stores ten-second-delay autosave + const saveTimeoutRef = useRef(null); // stores ten-second-delay const [isLoadingComponent, setIsLoadingComponent] = useState(true); const [isSubmitted, setIsSubmitted] = useState(false); const registrationAuth = useRegistrationAuth({ From 527e867139524dc4124ef1c5f9ea4e1d89fa18d0 Mon Sep 17 00:00:00 2001 From: miguelaenlle Date: Wed, 25 Feb 2026 17:07:35 -0600 Subject: [PATCH 4/4] Remove commenbt --- app/register/general/GeneralRegistration.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/register/general/GeneralRegistration.tsx b/app/register/general/GeneralRegistration.tsx index bdfb7be0..803978d0 100644 --- a/app/register/general/GeneralRegistration.tsx +++ b/app/register/general/GeneralRegistration.tsx @@ -48,7 +48,7 @@ export const GeneralRegistration = () => { const [showClickOffAlert, setShowClickOffAlert] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const [isSaving, setIsSaving] = useState(false); - const saveTimeoutRef = useRef(null); // stores ten-second-delay + const saveTimeoutRef = useRef(null); // stores ten-second-delay autosave const [isLoadingComponent, setIsLoadingComponent] = useState(true); const [isSubmitted, setIsSubmitted] = useState(false); const registrationAuth = useRegistrationAuth({