From f3691528c253b5763f3dfc533062c3e16d13cc81 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Fri, 6 Oct 2017 17:44:06 +0200 Subject: [PATCH] Handle the case where session expired --- lib/communication.js | 4 ++-- lib/repository.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/communication.js b/lib/communication.js index bd0ad4e6..df0e2123 100644 --- a/lib/communication.js +++ b/lib/communication.js @@ -13,7 +13,7 @@ export default { return new Promise((resolve, reject) => { request.post(url, options, (err, xhr, body) => { if (err) { - reject(); + reject(xhr.statusCode); return; } if (xhr.statusCode === 200 || Math.floor(xhr.statusCode / 100) === 3) { @@ -24,7 +24,7 @@ export default { }); } else resolve(); } else { - reject(body, xhr.statusCode); + reject(xhr.statusCode); } }); }); diff --git a/lib/repository.js b/lib/repository.js index 75ef6b02..c28c90ed 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -50,10 +50,10 @@ async function createWithDomain(base, domain, args, customTypes, users, noconfir eventuallyCreateRepository = queryCreateRepositoryWithCookie(base, domain, cookies, customTypes, users); } - eventuallyCreateRepository.then(() => { + return eventuallyCreateRepository.then(() => { Helpers.UI.display(`You can access your backend here: ${Helpers.Domain.repository(base, domain)}`); return domain; - }).catch((body, statusCode) => { + }).catch((statusCode) => { if (statusCode === 401) { // remove cookie return configuration.set({ cookies: '' }).then(() => (