mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-29 19:54:27 +00:00
Fix 401 error when publishing a new weblog entry
The add entry button in the toolbar wasn’t passing the selected address to the lower layers. As result, Triton was making a network request to create a new post without the address. In such cases, the API returns an error, 401. This commit ensures the address is getting passed down to the lower layers before making the network request.
This commit is contained in:
parent
1791cab97f
commit
f5a4bf476d
2 changed files with 15 additions and 5 deletions
|
|
@ -24,8 +24,8 @@ struct EditWeblogEntryScene: Scene {
|
|||
for: EditWeblogEntry.self
|
||||
) { $entry in
|
||||
makeEditorView(
|
||||
body: entry?.body ?? "# Title of your post\n\nThis is the body of your post...",
|
||||
date: entry?.date ?? Date(),
|
||||
body: entry?.body ?? "",
|
||||
date: entry?.date ?? .init(),
|
||||
entryID: entry?.entryID,
|
||||
address: entry?.address ?? ""
|
||||
)
|
||||
|
|
|
|||
|
|
@ -78,9 +78,19 @@ struct WeblogApp: View {
|
|||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func makeAddEntryToolbarItem() -> some View {
|
||||
private func makeAddEntryToolbarItem(
|
||||
address: SelectedAddress
|
||||
) -> some View {
|
||||
Button {
|
||||
openWindow(id: EditWeblogEntryWindow.id)
|
||||
openWindow(
|
||||
id: EditWeblogEntryWindow.id,
|
||||
value: EditWeblogEntry(
|
||||
address: address,
|
||||
body: "# Title of your post\n\nThis is the body of your post...",
|
||||
date: .init(),
|
||||
entryID: nil
|
||||
)
|
||||
)
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
|
|
@ -108,7 +118,7 @@ struct WeblogApp: View {
|
|||
helpText: "Refresh weblog entries",
|
||||
isDisabled: viewModel.isLoading
|
||||
)
|
||||
makeAddEntryToolbarItem()
|
||||
makeAddEntryToolbarItem(address: address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue