add fallback to url generating 404
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user