diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-03-17 21:17:06 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-03-17 21:17:06 -0400 |
commit | 674b158932394d3cad8bce8dedca49b1efdfd453 (patch) | |
tree | 8a4ad738fee49ebb9835e9e0822c36f1ebfaa2ac /ufund-api/src/main/java/com/ufund/api/ufundapi/controller | |
parent | 8951d00eddb147e5301454f250e503ad19aa47d3 (diff) | |
download | JellySolutions-674b158932394d3cad8bce8dedca49b1efdfd453.tar.gz JellySolutions-674b158932394d3cad8bce8dedca49b1efdfd453.tar.bz2 JellySolutions-674b158932394d3cad8bce8dedca49b1efdfd453.zip |
Attempt at fixing connection to front end
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/controller')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java index 7773028..4bad4b9 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java @@ -48,10 +48,11 @@ public class CupboardController { * INTERNAL_SERVER_ERROR otherwise */ @PostMapping("") - public ResponseEntity<Need> createNeed(@RequestBody Map<String, String> params) { - String name = params.get("name"); - int maxGoal = Integer.parseInt(params.get("maxGoal")); - Need.GoalType goalType = GoalType.valueOf(params.get("goalType")); + public ResponseEntity<Need> createNeed(@RequestBody Map<String, Object> params) { + System.out.println(params); + String name = (String) params.get("name"); + int maxGoal = (int) params.get("maxGoal"); + Need.GoalType goalType = GoalType.valueOf((String) params.get("goalType")); try { Need need = cupboardService.createNeed(name, maxGoal, goalType); @@ -152,8 +153,10 @@ public class CupboardController { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } } catch (InvalidParameterException ex) { + ex.printStackTrace(); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } catch (IOException e) { + } catch (IOException ex) { + ex.printStackTrace(); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } |