Fix issues with category text usage

This commit is contained in:
Jeremy Wall 2022-10-25 16:27:23 -04:00
parent 3fde0401b2
commit b957ed7f3a
2 changed files with 4 additions and 5 deletions

View File

@ -14,8 +14,7 @@
use std::collections::BTreeMap;
use reqwasm;
//use serde::{Deserialize, Serialize};
use serde_json::to_string;
use serde_json::{from_str, to_string};
use sycamore::prelude::*;
use tracing::{debug, error, info, instrument, warn};
@ -149,7 +148,7 @@ impl HttpStore {
Err(format!("Status: {}", resp.status()).into())
} else {
debug!("We got a valid response back!");
let resp = resp.text().await;
let resp = resp.json().await;
Ok(Some(resp.map_err(|e| format!("{}", e))?))
}
}

View File

@ -95,10 +95,10 @@ pub fn Categories<G: Html>(cx: Scope) -> View<G> {
view! {cx,
(dialog_view)
textarea(bind:value=category_text, rows=20)
a(role="button", href="#", on:click=move |_| {
span(role="button", on:click=move |_| {
check_category_text_parses(category_text.get().as_str(), error_text);
}) { "Check" } " "
a(role="button", href="#", on:click=move |_| {
span(role="button", on:click=move |_| {
// TODO(jwall): check and then save the categories.
if check_category_text_parses(category_text.get().as_str(), error_text) {
debug!("triggering category save");