Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/signup", method = RequestMethod.POST)
- public ResponseEntity<String> signup(@RequestBody Candidat candidat) throws Exception {
- String response = candidatMetier.signup(candidat);
- if (response.equals("username_already_exists"))
- return new ResponseEntity<>("User name already exists", HttpStatus.CONFLICT);
- else if (response.equals("email_already_exists"))
- return new ResponseEntity<>("Email already exists", HttpStatus.CONFLICT);
- else if (response.equals("mailer_error"))
- return new ResponseEntity<>("Cannot signup, reason : Email service is down",
- HttpStatus.SERVICE_UNAVAILABLE);
- else
- return new ResponseEntity<>("Signup successful", HttpStatus.OK);
- }
- .factory('signupService',['$resource',
- function ($resource) {
- return $resource('http://localhost:8080/signup', {}, {
- signup: { method: "POST"}
- });
- }])
- signupService.signup({
- type: "UC",
- username: $scope.user.username,
- password: $scope.user.password,
- email: $scope.user.email
- }).$promise.then(function(data){
- console.log(data);
- }).finally(function(){
- $scope.loading = false;
- $scope.signupSucceful = true;
- console.log('finished');
- });
- SyntaxError: Unexpected token S in JSON at position 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement