website refactor

This commit is contained in:
2026-01-17 15:46:55 +01:00
parent 4d5ce9bfd6
commit 72a626ce71
346 changed files with 19308 additions and 8605 deletions

View File

@@ -2,6 +2,7 @@ import { Result } from '@/lib/contracts/Result';
import { DomainError, Service } from '@/lib/contracts/services/Service';
import { AuthService } from './AuthService';
import type { AuthSessionDTO } from '@/lib/types/generated/AuthSessionDTO';
import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
/**
* Session Service
@@ -12,14 +13,22 @@ import type { AuthSessionDTO } from '@/lib/types/generated/AuthSessionDTO';
export class SessionService implements Service {
private authService: AuthService;
constructor() {
this.authService = new AuthService();
constructor(apiClient?: any) {
this.authService = new AuthService(apiClient);
}
/**
* Get current user session
*/
async getSession(): Promise<Result<AuthSessionDTO | null, DomainError>> {
return this.authService.getSession();
async getSession(): Promise<any> {
try {
const res = await this.authService.getSession();
if (!res) return null;
const data = (res as any).value || res;
if (!data || !data.user) return null;
return new SessionViewModel(data.user);
} catch (error: unknown) {
throw error;
}
}
}