Fix user info response
This commit is contained in:
@@ -10,10 +10,13 @@ class UserInfo {
|
||||
});
|
||||
|
||||
factory UserInfo.fromJson(Map<String, dynamic> json) {
|
||||
// Handle wrapped response from API (e.g., {"success": {...}})
|
||||
final data = json.containsKey('success') ? json['success'] : json;
|
||||
|
||||
return UserInfo(
|
||||
id: json['id'] as int,
|
||||
name: json['name'] as String?,
|
||||
username: json['username'] as String?,
|
||||
id: data['id'] as int,
|
||||
name: data['name'] as String?,
|
||||
username: data['username'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user