Added create tag

This commit is contained in:
Juan Gilsanz Polo
2024-02-24 13:50:07 +01:00
parent 5378d020e4
commit fe2f5629e3
13 changed files with 285 additions and 28 deletions

View File

@@ -70,7 +70,7 @@ class ApiClientService {
}
}
Future<ApiResponse<Bookmark>> fetchPostBookmark(PostBookmark bookmark) async {
Future<ApiResponse<Bookmark>> postBookmark(PostBookmark bookmark) async {
try {
final response = await dioInstance.post(
"/bookmarks/",
@@ -105,4 +105,20 @@ class ApiClientService {
return const ApiResponse(successful: false);
}
}
Future<ApiResponse<Tag>> postTag(String name) async {
try {
final response = await dioInstance.post(
"/tags/",
data: FormData.fromMap({"name": name}),
);
return ApiResponse(
successful: true,
content: Tag.fromJson(response.data),
);
} catch (e, stackTrace) {
Sentry.captureException(e, stackTrace: stackTrace);
return const ApiResponse(successful: false);
}
}
}