Handle existing urls

This commit is contained in:
Juan Gilsanz Polo
2024-07-18 19:34:48 +02:00
parent 8dacc0f4d4
commit 0a1eb60903
7 changed files with 41 additions and 7 deletions

View File

@@ -92,8 +92,18 @@ class BookmarkForm extends _$BookmarkForm {
}
final result = await ref.read(checkBookmarkProvider(state.urlController.text).future);
if (result.successful == true) {
state.titleController.text = result.content?.metadata?.title ?? "";
state.descriptionController.text = result.content?.metadata?.description ?? "";
if (result.content?.bookmark != null) {
state.titleController.text = result.content?.bookmark?.title ?? "";
state.descriptionController.text = result.content?.metadata?.description ?? "";
state.tags = result.content?.bookmark?.tagNames ?? [];
state.notesController.text = result.content?.bookmark?.notes ?? "";
state.markAsUnread = result.content?.bookmark?.unread ?? false;
state.share = result.content?.bookmark?.shared ?? false;
state.bookmarkExists = true;
} else {
state.titleController.text = result.content?.metadata?.title ?? "";
state.descriptionController.text = result.content?.metadata?.description ?? "";
}
state.bookmarkValid = true;
state.checkBookmarkLoadStatus = LoadStatus.loaded;
} else {