refactor(api): pass by reference
This commit is contained in:
parent
76a9695979
commit
3832510760
@ -45,8 +45,8 @@ pub struct Response {
|
|||||||
message: Option<Message>,
|
message: Option<Message>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn change_password(data: Json<PasswordData>,
|
fn change_password(data: &Json<PasswordData>,
|
||||||
context: rocket::State<Context>) -> Result<()> {
|
context: &rocket::State<Context>) -> Result<()> {
|
||||||
|
|
||||||
let dn = Handlebars::new()
|
let dn = Handlebars::new()
|
||||||
.render_template(&context.dn, &json!({"username" : &data.username}))
|
.render_template(&context.dn, &json!({"username" : &data.username}))
|
||||||
@ -72,7 +72,7 @@ fn change_password(data: Json<PasswordData>,
|
|||||||
pub fn update(data: Json<PasswordData>,
|
pub fn update(data: Json<PasswordData>,
|
||||||
context: rocket::State<Context>) -> Json<Response> {
|
context: rocket::State<Context>) -> Json<Response> {
|
||||||
Json(
|
Json(
|
||||||
match change_password(data, context) {
|
match change_password(&data, &context) {
|
||||||
Ok(_) => Response{
|
Ok(_) => Response{
|
||||||
success: true,
|
success: true,
|
||||||
message: None,
|
message: None,
|
||||||
|
Loading…
Reference in New Issue
Block a user