add fallback to url generating 404

This commit is contained in:
Trinity Pointard
2018-06-04 21:57:03 +02:00
parent 2fde47d909
commit 8158f19b85
8 changed files with 53 additions and 11 deletions
+8
View File
@@ -1,8 +1,11 @@
use rocket::response::{Redirect, Flash};
use rocket_contrib::Template;
use db_conn::DbConn;
use models::{notifications::Notification, users::User};
use utils;
#[get("/notifications")]
fn notifications(conn: DbConn, user: User) -> Template {
Template::render("notifications/index", json!({
@@ -10,3 +13,8 @@ fn notifications(conn: DbConn, user: User) -> Template {
"notifications": Notification::find_for_user(&*conn, &user)
}))
}
#[get("/notifications", rank = 2)]
fn notifications_auth() -> Flash<Redirect>{
utils::requires_login("You need to be logged in order to see your notifications", "/notifications")
}