feat: start working on sell
This commit is contained in:
parent
f378c8c0be
commit
1803a2b119
8 changed files with 94 additions and 31 deletions
|
|
@ -304,6 +304,27 @@ class ApiClient {
|
|||
* ====================
|
||||
*/
|
||||
|
||||
Future<Result<Owner>> getSectionOwner() async {
|
||||
final client = Client();
|
||||
try {
|
||||
final headers = await _getHeaders();
|
||||
final response = await client.get(
|
||||
Uri.parse("https://$apiBasePath/owner/self"),
|
||||
headers: headers,
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final json = jsonDecode(response.body);
|
||||
return Result.ok(Owner.fromJSON(json));
|
||||
} else {
|
||||
throw "Unknown error";
|
||||
}
|
||||
} catch (e) {
|
||||
return Result.error(Exception(e));
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/// Call on `/owners` to get a list of all [Owner]s
|
||||
Future<Result<List<Owner>>> getOwners() async {
|
||||
final client = Client();
|
||||
|
|
|
|||
Reference in a new issue