Use FlashMessage in todo example.

This commit is contained in:
Sergio Benitez 2016-11-02 18:49:06 +01:00
parent c2d3bdccdb
commit 2fec4209c9
1 changed files with 2 additions and 2 deletions

View File

@ -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),