feat: add ExamStageActions component for exam fee handling

- Implemented ExamStageActions component to manage actions related to exam booking and payment based on application status.
- Added mock-base-query for development, providing a partial mock backend for various API endpoints.
- Introduced mock-data for simulating responses in the mock-base-query, covering profiles, vessels, applications, licenses, exams, and notifications.
This commit is contained in:
fitse-yotor
2026-08-15 11:51:14 +03:00
parent d8b01a2003
commit 0ac75669d4
34 changed files with 2638 additions and 472 deletions

View File

@@ -7,15 +7,33 @@ export const SESSION_HEADER_KEYS = {
currentProjectId: 'x-current-project-id',
} as const;
const TOKEN_STORAGE_KEYS = [
'ema-backoffice-auth-token',
'ema-portal-auth-token',
'auth-token',
] as const;
/**
* 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:4200` 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.
*/
let scopedTokenKey: string | undefined;
export function configureSessionScope(prefix: string): void {
scopedTokenKey = `${prefix}-auth-token`;
}
/** Legacy, pre-prefix sessions. Read only when the scoped key is empty. */
const LEGACY_TOKEN_KEY = 'auth-token';
export function resolveTokenFromStorage(): string | undefined {
// cookie first, then localStorage (legacy pre-migration sessions)
for (const key of TOKEN_STORAGE_KEYS) {
// Only this app's key, then the legacy unprefixed one. Never another app's:
// falling through to a sibling's token is how a backoffice tab ends up
// holding a portal session.
const keys = scopedTokenKey
? [scopedTokenKey, LEGACY_TOKEN_KEY]
: [LEGACY_TOKEN_KEY];
for (const key of keys) {
// cookie first, then localStorage (legacy pre-migration sessions)
const cookie = Cookies.get(key);
if (cookie) return cookie;
const stored = localStorage.getItem(key);