public ResponseEntity<List<SalleResponse>> getAvailableSalles(
@RequestParam("checkIndate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate checkInDate,
@RequestParam("checkOutdate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate checkOutDate,
@RequestParam("salletype") String salleType) throws SQLException {
List<Salle> availableSalles = salleService.getAvailableSalles(checkInDate, checkOutDate, salleType);
List<SalleResponse> salleResponses = new ArrayList<>();
for (Salle salle : availableSalles){
byte[] imageBytes = salleService.getSalleImageBySalleId(salle.getId());
if (imageBytes != null && imageBytes.length > 0){
String imageBase64 = Base64.encodeBase64String(imageBytes);
SalleResponse salleResponse = getSalleResponse(salle);
salleResponse.setImage(imageBase64);
salleResponses.add(salleResponse);
}
}
if(salleResponses.isEmpty()){
return ResponseEntity.noContent().build();
}else{
return ResponseEntity.ok(salleResponses);
}
}
why im getting a list of salles in frontend using axios get but using postman i don’t get anything i only get no content while im using the same approach in another function and im getting the right response both in frontend and postman?
New contributor
beginner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.