Fix user info response
This commit is contained in:
@@ -10,10 +10,13 @@ class UserInfo {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory UserInfo.fromJson(Map<String, dynamic> json) {
|
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(
|
return UserInfo(
|
||||||
id: json['id'] as int,
|
id: data['id'] as int,
|
||||||
name: json['name'] as String?,
|
name: data['name'] as String?,
|
||||||
username: json['username'] as String?,
|
username: data['username'] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user