Files

37 lines
951 B
Dart
Raw Permalink Normal View History

2026-02-25 14:45:08 +08:00
class AuthUser {
final String id;
final String phone;
2026-02-25 14:45:08 +08:00
const AuthUser({required this.id, required this.phone});
2026-02-25 14:45:08 +08:00
factory AuthUser.fromJson(Map<String, dynamic> json) {
return AuthUser(id: json['id'] as String, phone: json['phone'] as String);
2026-02-25 14:45:08 +08:00
}
}
class AuthResponse {
final String accessToken;
final String refreshToken;
final int expiresIn;
final String tokenType;
final AuthUser user;
const AuthResponse({
required this.accessToken,
required this.refreshToken,
required this.expiresIn,
required this.tokenType,
required this.user,
});
factory AuthResponse.fromJson(Map<String, dynamic> json) {
return AuthResponse(
accessToken: json['access_token'] as String,
refreshToken: json['refresh_token'] as String,
expiresIn: json['expires_in'] as int,
tokenType: json['token_type'] as String,
user: AuthUser.fromJson(json['user'] as Map<String, dynamic>),
);
}
}