added frontend

This commit is contained in:
verboomp
2026-01-21 16:08:09 +01:00
parent d2e6f5164a
commit b3de3eec8c
74 changed files with 4938 additions and 26 deletions

View File

@@ -0,0 +1,15 @@
final class ErrorDto {
int error;
String message;
ErrorDto(this.error, this.message);
ErrorDto.fromJson(Map<String, dynamic> json)
: error = json['error'] as int,
message = json['message'];
}
abstract interface class DtoMapAble {
Map<String, dynamic> toMap();
}

View File

@@ -0,0 +1,50 @@
/// DTO representing a failes login attempt request for 2fa token.
class TokenRequiredDto {
final bool? tokenRequired;
final bool? tokenInValid;
TokenRequiredDto({
required this.tokenRequired,
required this.tokenInValid,
});
/// Create from JSON response
factory TokenRequiredDto.fromJson(Map<String, dynamic> json) {
return TokenRequiredDto(
tokenRequired: json['tokenRequired'] as bool,
tokenInValid: json['tokenInValid'] as bool,
);
}
}
/// DTO representing a pair of JWT tokens from the backend.
class JwtTokenPairDto {
final String accessToken;
final String refreshToken;
JwtTokenPairDto({
required this.accessToken,
required this.refreshToken,
});
/// Create from JSON response
factory JwtTokenPairDto.fromJson(Map<String, dynamic> json) {
return JwtTokenPairDto(
accessToken: json['accessToken'] as String,
refreshToken: json['refreshToken'] as String,
);
}
/// Convert to JSON (for serialization if needed)
Map<String, dynamic> toJson() {
return {
'accessToken': accessToken,
'refreshToken': refreshToken,
};
}
@override
String toString() {
return 'JwtTokenPairDto{accessToken: [REDACTED], refreshToken: [REDACTED]}';
}
}