feat: start of pending screen
This commit is contained in:
parent
019a21f00e
commit
ee9c4c3801
12 changed files with 425 additions and 67 deletions
|
|
@ -22,6 +22,17 @@ class BalRepository {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Result<List<Bal>>> _getBalsNoCache() async {
|
||||
final result = await _apiClient.getBals();
|
||||
switch (result) {
|
||||
case Ok():
|
||||
_bals = result.value;
|
||||
return Result.ok(result.value);
|
||||
case Error():
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Result<Bal>> balById(int id) async {
|
||||
if (_bals == null) {
|
||||
await getBals();
|
||||
|
|
@ -39,13 +50,20 @@ class BalRepository {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Result<void>> addBal(String name) async {
|
||||
final result = await _apiClient.addBal(name);
|
||||
switch (result) {
|
||||
case Ok():
|
||||
return result;
|
||||
case Error():
|
||||
return result;
|
||||
}
|
||||
Future<Result<Bal>> editBal(
|
||||
int id,
|
||||
String name,
|
||||
DateTime start,
|
||||
DateTime end,
|
||||
) async {
|
||||
final result = await _apiClient.editBal(id, name, start, end);
|
||||
_getBalsNoCache();
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Result<void>> addBal(String name, DateTime start, DateTime end) async {
|
||||
final result = await _apiClient.addBal(name, start, end);
|
||||
_getBalsNoCache();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue