mirror of
https://github.com/go-vikunja/app
synced 2024-06-01 02:06:51 +00:00
ee99869cf6
* Ran make format Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Add VS Code launch config Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * pages/list/list.dart: Stop spinning wheel after adding a task Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * stores/list_store.dart: Fix updateTask() not being a future Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Replace FlatButton with TextButton widgets Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * components/TaskTile.dart: Remove dead code Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * theme/theme.dart: Fix accentColor deprecation Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * pages/list/list_edit.dart: Fix SnackBar.hideCurrentSnackBar() deprecation Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Remove unused folder lib/managers Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>
33 lines
1.1 KiB
Dart
33 lines
1.1 KiB
Dart
import 'package:vikunja_app/api/client.dart';
|
|
import 'package:vikunja_app/api/service.dart';
|
|
import 'package:vikunja_app/models/label.dart';
|
|
import 'package:vikunja_app/models/labelTask.dart';
|
|
import 'package:vikunja_app/service/services.dart';
|
|
|
|
class LabelTaskAPIService extends APIService implements LabelTaskService {
|
|
LabelTaskAPIService(Client client) : super(client);
|
|
|
|
@override
|
|
Future<Label> create(LabelTask lt) async {
|
|
return client
|
|
.put('/tasks/${lt.task.id}/labels', body: lt.toJSON())
|
|
.then((result) => Label.fromJson(result.body));
|
|
}
|
|
|
|
@override
|
|
Future<Label> delete(LabelTask lt) async {
|
|
return client
|
|
.delete('/tasks/${lt.task.id}/labels/${lt.label.id}')
|
|
.then((result) => Label.fromJson(result.body));
|
|
}
|
|
|
|
@override
|
|
Future<List<Label>> getAll(LabelTask lt, {String query}) async {
|
|
String params =
|
|
query == '' ? null : '?s=' + Uri.encodeQueryComponent(query);
|
|
|
|
return client.get('/tasks/${lt.task.id}/labels$params').then(
|
|
(label) => convertList(label, (result) => Label.fromJson(result)));
|
|
}
|
|
}
|