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:
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 ???
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??