skip to Main Content

Reactjs – can someone help me understand why my api is not working?

So i have this register api created @PostMapping("/register") public ResponseEntity<String> register(@RequestBody RegisterRequest registerRequest){ if (userRepository.findByEmail(registerRequest.getEmail())!=null){ return new ResponseEntity<>("Email already exist",HttpStatus.BAD_REQUEST); } User user = new User(); user.setEmail(registerRequest.getEmail()); user.setName(registerRequest.getName()); user.setLastName(registerRequest.getLastName()); user.setPassword(passwordEncoder.encode(registerRequest.getPassword())); userRepository.save(user); authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(registerRequest.getEmail(), registerRequest.getPassword()) ); return new ResponseEntity<>(jwtUtil.generateToken( registerRequest.getEmail(),…

VIEW QUESTION
Back To Top
Search