refactor(api): pass by reference

This commit is contained in:
Philipp Matthias Schaefer 2021-02-27 21:09:00 +01:00
parent 76a9695979
commit 3832510760

View File

@ -45,8 +45,8 @@ pub struct Response {
message: Option<Message>,
}
fn change_password(data: Json<PasswordData>,
context: rocket::State<Context>) -> Result<()> {
fn change_password(data: &Json<PasswordData>,
context: &rocket::State<Context>) -> Result<()> {
let dn = Handlebars::new()
.render_template(&context.dn, &json!({"username" : &data.username}))
@ -72,7 +72,7 @@ fn change_password(data: Json<PasswordData>,
pub fn update(data: Json<PasswordData>,
context: rocket::State<Context>) -> Json<Response> {
Json(
match change_password(data, context) {
match change_password(&data, &context) {
Ok(_) => Response{
success: true,
message: None,