update POST /logout error messages

This commit is contained in:
SadlyNotSappho 2024-03-19 13:17:06 -07:00
parent 2c128a1e1f
commit 68e18b89a1
1 changed files with 3 additions and 3 deletions

View File

@ -147,13 +147,13 @@ async fn login(mut db: Connection<Db>, info: Json<LoginInfo>, cookies: &CookieJa
} }
} }
#[post("/logout")] #[post("/logout")]
async fn logout(cookies: &CookieJar<'_>) -> &'static str { async fn logout(cookies: &CookieJar<'_>) -> status::Custom<&'static str> {
match cookies.get_private("token") { match cookies.get_private("token") {
Some(_) => { Some(_) => {
cookies.remove_private("token"); cookies.remove_private("token");
"Logged out." status::Custom(Status::Ok, "Logged out.")
} }
None => "Not logged in.", None => status::Custom(Status::Unauthorized, "Not logged in."),
} }
} }