diff --git a/src/main.rs b/src/main.rs index 58bbfb0..c22fd0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -147,13 +147,13 @@ async fn login(mut db: Connection, info: Json, cookies: &CookieJa } } #[post("/logout")] -async fn logout(cookies: &CookieJar<'_>) -> &'static str { +async fn logout(cookies: &CookieJar<'_>) -> status::Custom<&'static str> { match cookies.get_private("token") { Some(_) => { cookies.remove_private("token"); - "Logged out." + status::Custom(Status::Ok, "Logged out.") } - None => "Not logged in.", + None => status::Custom(Status::Unauthorized, "Not logged in."), } }