mirror of https://github.com/rwf2/Rocket.git
Use FlashMessage in todo example.
This commit is contained in:
parent
c2d3bdccdb
commit
2fec4209c9
|
@ -12,7 +12,7 @@ extern crate serde_json;
|
||||||
mod static_files;
|
mod static_files;
|
||||||
mod task;
|
mod task;
|
||||||
|
|
||||||
use rocket::request::Form;
|
use rocket::request::{Form, FlashMessage};
|
||||||
use rocket::response::{Flash, Redirect};
|
use rocket::response::{Flash, Redirect};
|
||||||
use rocket_contrib::Template;
|
use rocket_contrib::Template;
|
||||||
use task::Task;
|
use task::Task;
|
||||||
|
@ -63,7 +63,7 @@ fn delete(id: i32) -> Result<Flash<Redirect>, Template> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
fn index(msg: Option<Flash<()>>) -> Template {
|
fn index(msg: Option<FlashMessage>) -> Template {
|
||||||
Template::render("index", &match msg {
|
Template::render("index", &match msg {
|
||||||
Some(ref msg) => Context::raw(Some((msg.name(), msg.msg()))),
|
Some(ref msg) => Context::raw(Some((msg.name(), msg.msg()))),
|
||||||
None => Context::raw(None),
|
None => Context::raw(None),
|
||||||
|
|
Loading…
Reference in New Issue