From 8577d51db3f541380980a34da593a65486034a38 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 8 Oct 2018 12:05:19 +0200 Subject: [PATCH] Recalculating Cache after new teamSetup --- AABrowserAPI/TeamSetup.js | 37 ++++++++++++++++++++----------------- server.js | 8 ++++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/AABrowserAPI/TeamSetup.js b/AABrowserAPI/TeamSetup.js index a7397b064..2360c4c2e 100644 --- a/AABrowserAPI/TeamSetup.js +++ b/AABrowserAPI/TeamSetup.js @@ -537,23 +537,26 @@ }; usersModuleAPI.query(` - mutation($authId: String, $sessionToken: String){ - updateSessionToken(authId: $authId, sessionToken: $sessionToken){ - id - alias - } - } - `, variables, function (req, res) { - if (res.status === 401) { - console.log('Error trying to save the session token at the Users Module'); - } - }).then(res => { - if (res.errors) { - console.log('Error trying to save the session token at the Users Module'); - } - }).catch(error => { - console.log('Error trying to save the session token at the Users Module'); - }); + mutation($authId: String, $sessionToken: String){ + updateSessionToken(authId: $authId, sessionToken: $sessionToken){ + id + alias + } + } + `, variables, function (req, res) { + if (res.status === 401) { + console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module'); + console.log('[ERROR] TeamSetup -> newTeam -> res.status = 401'); + } + }).then(res => { + if (res.errors) { + console.log('[ERROR] TeamSetup -> newTeam -> Error trying to save the session token at the Users Module'); + console.log('[ERROR] TeamSetup -> newTeam -> res.errors = ' + res.errors); + } + }).catch(error => { + console.log('Error trying to save the session token at the Users Module'); + console.log('[ERROR] TeamSetup -> newTeam -> errors = ' + errors); + }); } catch (err) { diff --git a/server.js b/server.js index 8f447e50f..2c4b77282 100644 --- a/server.js +++ b/server.js @@ -595,6 +595,14 @@ function onBrowserRequest(request, response) { function onSetupFinished(err) { + if (err.result === global.DEFAULT_OK_RESPONSE.result) { + + /* We must re-load all the webserver caches.*/ + + initialize(); + + } + respondWithContent(JSON.stringify(err), response); } break;