0

i am developing an application with ExtJS 4.2.1 and a .NET Web API backend...

When i create i new user through the gui i add it to my store and sync it afterwards... something like this

this is a snippet from my alter-user-window

window.on('save', function(win) {            
            this.getForm().updateRecord(this.getUser());
            if (!this.getUser().validate().isValid()) {
                this.getForm().markInvalid(this.getUser().validate().items);
                return;   
            }            

            if (win.getType() == 'new') {                
                userController.addUserToStore(this.getUser());                
            }

            userController.syncUserStore();

        }, this);

In my userstore i wont have all users loaded every time. So i need to check the availability of the username on the server anyway..

My questions:

  1. should i make an additional request to check the username availability or should i just send an other response from the server when i do want to save the user ???

  2. what should the response look like if the username is not valid? should i send and ErrorResponseCode like 409 Conflict or something or should i send just a 200 OK Response with a special response message??

JuHwon
  • 2,033
  • 2
  • 34
  • 54

1 Answers1

1
  1. Completely depends on you. Both options are OK.

  2. Returning 409 is a good idea. HTTP Status 409 is meant to be used for returning application-specific conflict error.

player
  • 610
  • 6
  • 15