diff options
author | azul <azul@riseup.net> | 2013-07-06 07:47:19 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-07-06 07:47:19 -0700 |
commit | 926a5d5960db51903e33c8496487da59f9f41242 (patch) | |
tree | dc504596bef7b18bace664626334947e62e91214 /src/jqueryRest.js | |
parent | e7a0b830b8f994316a560001a9e7397422b184b1 (diff) | |
parent | bd6d60789bfb97041d0d219f645c08b7b479b782 (diff) |
Merge pull request #2 from elijh/feature/always-use-v1
always use the API-only controller for all requests.
Diffstat (limited to 'src/jqueryRest.js')
-rw-r--r-- | src/jqueryRest.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/jqueryRest.js b/src/jqueryRest.js index c1eb3c1..85ef0ca 100644 --- a/src/jqueryRest.js +++ b/src/jqueryRest.js @@ -3,24 +3,24 @@ srp.remote = (function(){ // TODO: Do we need to differentiate between PUT and POST? function register(session) { - return $.post("/users.json", {user: session.signup() }); + return $.post("/1/users.json", {user: session.signup() }); } - function update(url, session) { + function update(session) { return $.ajax({ - url: url, + url: "/1/users/" + session.id() + ".json", type: 'PUT', data: {user: session.signup() } }); } function handshake(session) { - return $.post("/sessions.json", session.handshake()); + return $.post("/1/sessions.json", session.handshake()); } function authenticate(session) { return $.ajax({ - url: "/sessions/" + session.login() + ".json", + url: "/1/sessions/" + session.login() + ".json", type: 'PUT', data: {client_auth: session.getM()} }); @@ -43,7 +43,7 @@ srp.remote = (function(){ function update(submitEvent){ var form = submitEvent.target; - jqueryRest.update(form.action, srp.session) + jqueryRest.update(srp.session) .done(srp.updated) .fail(error) }; @@ -62,8 +62,8 @@ srp.remote = (function(){ } else if(! response.salt || response.salt === 0) { srp.error("Server failed to send salt - could not login."); - } - else + } + else { srp.session.calculations(response.salt, response.B); jqueryRest.authenticate(srp.session) @@ -85,7 +85,7 @@ srp.remote = (function(){ // The server will send error messages as json alongside // the http error response. function error(xhr, text, thrown) - { + { if (xhr.responseText && xhr.responseText != "") srp.error($.parseJSON(xhr.responseText)); else |