update the new school year model

This commit is contained in:
root
2026-06-07 20:01:56 -04:00
parent 8e79201a3c
commit b6513ab22f
9 changed files with 304 additions and 107 deletions
+10 -7
View File
@@ -3,20 +3,23 @@ const PROD_API_ORIGIN = 'https://api.alrahmaisgl.org'
/**
* Laravel API base URL.
*
* **Vite dev:** same-origin `/api/...`; `vite.config.ts` proxies to the API (default `http://localhost:8080`).
* Override proxy target with **`VITE_PROXY_API`**. **`VITE_API_ORIGIN` is not used in dev** (avoids cross-origin from the browser).
* Dev defaults to same-origin `/api/...` so Vite can proxy requests to Laravel.
* Set `VITE_API_ORIGIN` when you want the browser to call Laravel directly, e.g.
* `VITE_API_ORIGIN=http://localhost:8000 npm run dev`.
*
* **Production build:** `VITE_API_ORIGIN` if set, else `PROD_API_ORIGIN`.
* If `VITE_API_ORIGIN` is not set in dev, `vite.config.ts` proxies `/api` to
* `VITE_PROXY_API` or `http://localhost:8000` by default.
*/
export function apiOrigin(): string {
if (import.meta.env.DEV) {
return ''
}
const v = import.meta.env.VITE_API_ORIGIN
if (typeof v === 'string' && v.trim()) {
return v.replace(/\/$/, '')
}
if (import.meta.env.DEV) {
return ''
}
return PROD_API_ORIGIN
}