website refactor
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
|
||||
import { AuthApiClient } from '@/lib/api/auth/AuthApiClient';
|
||||
import type { AuthSessionDTO } from '@/lib/types/generated/AuthSessionDTO';
|
||||
import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
|
||||
|
||||
/**
|
||||
* Session Service
|
||||
*
|
||||
* Orchestrates session operations by coordinating API calls and view model creation.
|
||||
* All dependencies are injected via constructor.
|
||||
* Returns SessionViewModel for client consumption.
|
||||
*/
|
||||
export class SessionService {
|
||||
constructor(
|
||||
@@ -13,10 +13,11 @@ export class SessionService {
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get current user session with view model transformation
|
||||
* Get current user session (returns ViewModel)
|
||||
*/
|
||||
async getSession(): Promise<SessionViewModel | null> {
|
||||
const dto = await this.apiClient.getSession();
|
||||
return dto ? new SessionViewModel(dto.user) : null;
|
||||
if (!dto) return null;
|
||||
return new SessionViewModel(dto.user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user