|
@@ -32,7 +32,7 @@ public class CartController {
|
|
|
|
|
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
public ResponseEntity<Object> addToCart(@RequestBody AddToCartDto addToCartDto) throws RejectedRequestException {
|
|
public ResponseEntity<Object> addToCart(@RequestBody AddToCartDto addToCartDto) throws RejectedRequestException {
|
|
|
- String token = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("Authorization").substring("Bearer: ".length());
|
|
|
|
|
|
|
+ String token = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("Authorization").substring("Bearer ".length());
|
|
|
AppUser appUser = appUserService.getUserFromToken(token);
|
|
AppUser appUser = appUserService.getUserFromToken(token);
|
|
|
Plant plant = plantService.findPlantById(addToCartDto.getPlantId());
|
|
Plant plant = plantService.findPlantById(addToCartDto.getPlantId());
|
|
|
cartService.addToCart(addToCartDto, plant, appUser);
|
|
cartService.addToCart(addToCartDto, plant, appUser);
|
|
@@ -44,4 +44,5 @@ public class CartController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|