From bd6d60789bfb97041d0d219f645c08b7b479b782 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 4 Jul 2013 03:51:16 -0700 Subject: always use the API-only controller for all requests. --- src/jqueryRest.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/jqueryRest.js') 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 -- cgit v1.2.3