mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-29 15:18:12 +00:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
11
.env.example
11
.env.example
@@ -12,10 +12,8 @@
|
||||
# frontend never speaks to Fayda directly.
|
||||
|
||||
# Base URL of the emaapi backend, including the /api prefix.
|
||||
# 3001, not 3000: the portal itself takes 3000 in development, because that is
|
||||
# the port in the Fayda redirect URI registered for local testing. Set PORT=3001
|
||||
# in emaapi's .env to match.
|
||||
VITE_BASE_API_URL=http://localhost:3001/api
|
||||
# The portal runs on 4200 and the local API runs on 3000.
|
||||
VITE_BASE_API_URL=http://localhost:3000/api
|
||||
|
||||
# Serve fixture data instead of calling the API. Any value other than "true"
|
||||
# uses the real backend.
|
||||
@@ -25,7 +23,7 @@ VITE_USE_MOCKS=false
|
||||
# Host ports published by docker-compose.yml. It also expects per-app env files
|
||||
# at apps/portal/.env and apps/backoffice/.env, which can each be a copy of this
|
||||
# file. Ignored when running the Vite dev servers, which serve the portal on
|
||||
# 3000 and the backoffice on 4201.
|
||||
# 4200 and the backoffice on 4201.
|
||||
# EMA_PORTAL_PORT=8021
|
||||
# EMA_BACKOFFICE_PORT=8022
|
||||
|
||||
@@ -34,6 +32,5 @@ VITE_USE_MOCKS=false
|
||||
# page at /callback and /signup/fayda/callback, and whichever path is registered
|
||||
# with Fayda must match the API's FAYDA_REDIRECT_URI exactly.
|
||||
#
|
||||
# The value being registered first is http://localhost:3001/callback, so the
|
||||
# portal's dev server now listens on 3000 and emaapi moves to 3001. Nothing
|
||||
# Register http://localhost:4200/callback with Fayda. Nothing
|
||||
# extra to run — `nx serve portal` already binds the right port.
|
||||
|
||||
@@ -91,7 +91,7 @@ npm run dev:all
|
||||
|
||||
| Variable | Required | Default | Description |
|
||||
| ----------------------------- | ------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `VITE_BASE_API_URL` | Yes | `http://localhost:3001` | Base URL for all API requests |
|
||||
| `VITE_BASE_API_URL` | Yes | `http://localhost:3000` | Base URL for all API requests |
|
||||
| `VITE_ENABLE_DEVELOPER_TOOLS` | No | `true` | Toggle Redux DevTools |
|
||||
| `VITE_PAYMENT_API_URL` | Yes (portal) | — | Base URL for the payment service (portal `payment` feature). Can be a same-origin path if a backend proxy is later placed in front of it |
|
||||
| `VITE_PAYMENT_SERVICE_TOKEN` | Yes (portal) | — | Sent as `x-service-token` on every payment request. Note: bundled `VITE_*` values are public in the built app, not secret |
|
||||
|
||||
@@ -17,7 +17,7 @@ export default defineConfig({
|
||||
// port: 4201,
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: 'http://localhost:3001', // change from 'https://ema-api-dev.triaplc.com'
|
||||
// target: 'http://localhost:3000', // change from 'https://ema-api-dev.triaplc.com'
|
||||
// changeOrigin: true,
|
||||
// },
|
||||
// },
|
||||
|
||||
@@ -9,20 +9,17 @@ export default defineConfig({
|
||||
// built-in default.
|
||||
envDir: "../../",
|
||||
cacheDir: "../../node_modules/.vite/apps/portal",
|
||||
// 3000, not the usual 4200: the Fayda redirect URI registered for local
|
||||
// testing is http://localhost:3001/callback, and the provider matches it
|
||||
// exactly. The API moves to 3001 to make room.
|
||||
server: { port: 3000, host: "localhost" },
|
||||
server: { port: 4200, host: "localhost" },
|
||||
// server: {
|
||||
// port: 4200,
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: 'http://localhost:3001', // change from 'https://ema-api-dev.triaplc.com'
|
||||
// target: 'http://localhost:3000', // change from 'https://ema-api-dev.triaplc.com'
|
||||
// changeOrigin: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
preview: { port: 3000, host: "localhost" },
|
||||
preview: { port: 4200, host: "localhost" },
|
||||
plugins: [react(), nxViteTsPaths()],
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom", "react-router-dom", "@tanstack/react-query"],
|
||||
|
||||
@@ -10,7 +10,7 @@ import { resolveSessionContext } from "../session";
|
||||
export const BASE_API_URL =
|
||||
(import.meta as { env?: Record<string, string> }).env?.[
|
||||
"VITE_BASE_API_URL"
|
||||
]?.trim() || "http://localhost:3001/api";
|
||||
]?.trim() || "http://localhost:3000/api";
|
||||
|
||||
let _onTokenExpired: (() => Promise<string>) | null = null;
|
||||
let _onAuthFailure: (() => void) | null = null;
|
||||
|
||||
@@ -11,7 +11,7 @@ export const SESSION_HEADER_KEYS = {
|
||||
* Which app this bundle is, so it reads its own session and no one else's.
|
||||
*
|
||||
* Set by each app's store via `configureSessionScope`. Cookies ignore the
|
||||
* port, so `localhost:3001` and `localhost:4201` share one jar: without a
|
||||
* port, so `localhost:3000` and `localhost:4201` share one jar: without a
|
||||
* scope the backoffice would happily authenticate as whoever last signed into
|
||||
* the portal, and render a staff console with an applicant's permissions.
|
||||
*/
|
||||
|
||||
2531
package-lock.json
generated
2531
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user