Skip to content

Commit

Permalink
chore: trim whitespace from title and content in publisher component
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Liendo committed Sep 24, 2024
1 parent 84852f9 commit a726f72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/web/src/components/publisher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ pub fn Publisher() -> impl IntoView {
let send_post_action = create_action(move |data: &(String, String)| {
let (title, content) = data;

let title = title.to_owned();
let title = title.trim().to_owned();

if title.is_empty() {
creation_error.set(Some("Title is required".to_owned()));
()
}

let content = if content.trim().is_empty() {
let content = if content.is_empty() {
None
} else {
Some(content.to_owned())
Some(content.trim().to_owned())
};

async move {
Expand Down

0 comments on commit a726f72

Please sign in to comment.