refactor(api): pass by reference
This commit is contained in:
parent
76a9695979
commit
3832510760
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user