Skip to content

Commit

Permalink
Push new url after saving snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Nov 7, 2023
1 parent 294de66 commit 4b169af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions glot_core/src/page/snippet_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,14 @@ impl Page<Model, Msg, AppEffect, Markup> for SnippetPage {
"GotCreateSnippetResponse" => {
let snippet: Snippet = serde_json::from_value(msg.data)
.map_err(|err| format!("Failed to decode snippet from js: {}", err))?;
let log_effect = browser::console::log(&format!("Got snippet: {}", snippet.id));
Ok(vec![log_effect])

let route = Route::EditSnippet(snippet.id.clone());
let url_effect = browser::push_url(&route.to_path());

model.snippet = Some(snippet);
model.current_route = route;

Ok(vec![url_effect])
}

_ => {
Expand Down

0 comments on commit 4b169af

Please sign in to comment.