ADD::Clientside method

This commit is contained in:
Merel Steenbergen
2019-04-09 17:03:56 +02:00
parent 99899dfc88
commit 8e747e54be

View File

@@ -332,4 +332,20 @@ public class UserService {
.build().encode().toUri(), List.class);
return result;
}
/**
* Removes a user from the database.
* @param name the username of the current user.
*/
@SuppressWarnings("Duplicates")
public void deleteAccount(String name) {
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:8080/deleteAccount")
.queryParam("name", name);
HttpEntity<?> entity = new HttpEntity<>(headers);
System.out.println(builder.build().encode().toUri());
ResponseEntity<String> authenticateResponse = this.restTemplate.getForEntity(builder.build()
.encode().toUri(), String.class);
}
}