fix issues
This commit is contained in:
@@ -5,13 +5,14 @@ export class SessionViewModel {
|
||||
email: string;
|
||||
displayName: string;
|
||||
avatarUrl?: string | null;
|
||||
role?: string;
|
||||
|
||||
constructor(dto: AuthenticatedUserDTO) {
|
||||
this.userId = dto.userId;
|
||||
this.email = dto.email;
|
||||
this.displayName = dto.displayName;
|
||||
|
||||
const anyDto = dto as unknown as { primaryDriverId?: unknown; driverId?: unknown; avatarUrl?: unknown };
|
||||
const anyDto = dto as unknown as { primaryDriverId?: unknown; driverId?: unknown; avatarUrl?: unknown; role?: unknown };
|
||||
if (typeof anyDto.primaryDriverId === 'string' && anyDto.primaryDriverId) {
|
||||
this.driverId = anyDto.primaryDriverId;
|
||||
} else if (typeof anyDto.driverId === 'string' && anyDto.driverId) {
|
||||
@@ -20,6 +21,9 @@ export class SessionViewModel {
|
||||
if (anyDto.avatarUrl !== undefined) {
|
||||
this.avatarUrl = anyDto.avatarUrl as string | null;
|
||||
}
|
||||
if (typeof anyDto.role === 'string' && anyDto.role) {
|
||||
this.role = anyDto.role;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: The generated DTO doesn't have these fields
|
||||
|
||||
Reference in New Issue
Block a user