Commit dc23fc61 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Keep the old version of /session request still working.

Add a new version with a different name alongside it.

This way we can keep two versions of the API working at the same time,
which is needed when first deploying the backend code and then waiting
for the frontend code to get moved into live.
parent 2dc78eac
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -59,7 +59,23 @@ app.configure(function() {

// Authentication

// Old version for backwards compat.
app.get('/auth/session', function(req, res) {
    new Request(req).getUser(function(user) {
        if (user) {
            res.json({
                userName: user.username,
                mod: user.moderator
            });
        }
        else {
            res.json(false);
        }
    });
});

// New version.
app.get('/auth/session_new', function(req, res) {
    new Request(req).getUser(function(user) {
        if (user) {
            res.json({
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ Ext.define('Docs.controller.Auth', {
     */
    retrieveSession: function() {
        Ext.Ajax.request({
            url: Docs.baseUrl + '/session',
            url: Docs.baseUrl + '/session_new',
            params: { sid: this.sid },
            method: 'GET',
            cors: true,