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