Merge branch 'feature/exam-attempt-domain' of github.com:Tria-plc/emaui into feature/exam-attempt-domain

This commit is contained in:
mihretue
2026-08-17 11:51:33 +03:00
8 changed files with 210 additions and 250 deletions

View File

@@ -1,12 +1,13 @@
import { useEffect, useState, type ReactNode } from 'react';
import { useDispatch } from 'react-redux';
import { authStorage } from '../utils/auth-storage';
import { hydrateAuth, logout, setUser } from '../store/auth.slice';
import type { AuthUser } from '../types/auth.types';
import { useEffect, useState, type ReactNode } from "react";
import { useDispatch } from "react-redux";
import { authStorage } from "../utils/auth-storage";
import { hydrateAuth, logout, setUser } from "../store/auth.slice";
import type { AuthUser } from "../types/auth.types";
const BASE_API_URL =
(import.meta as { env?: Record<string, string> }).env?.['VITE_BASE_API_URL'] ??
'http://localhost:3001/api';
(import.meta as { env?: Record<string, string> }).env?.[
"VITE_BASE_API_URL"
] ?? "http://localhost:3000/api";
/**
* Restores the signed-in session before the router renders.

View File

@@ -3,7 +3,7 @@ import { authStorage } from "./auth-storage";
const BASE_API_URL =
(import.meta as { env?: Record<string, string> }).env?.[
"VITE_BASE_API_URL"
] ?? "http://localhost:3001/api";
] ?? "http://localhost:3000/api";
interface RefreshResponse {
token: string;
@@ -17,8 +17,8 @@ export async function refreshAccessToken(): Promise<string> {
// The IAM service exposes this as `refresh-token`; posting to `/auth/refresh`
// 404s, which the catch below turns into a silent logout.
const response = await fetch(`${BASE_API_URL}/auth/refresh-token`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ refreshToken }),
});