From 9e0f01f8aa7027ccfa25f6e235ef582fbe2cf017 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 13 Jan 2021 13:15:36 +0100 Subject: [PATCH] Bug fiexs --- Client/httpInterface.js | 19 ++++++++++++------- .../UI/Spaces/Docs-Space/DocsSpace.js | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 8f1f0ea72..1e535f377 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -654,13 +654,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE checkout() async function checkout() { - let message = await doGit() + let result = await doGit() - let customResponse = { - result: global.CUSTOM_OK_RESPONSE.result, - message: message + if (result === true) { + respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) + } else { + respondWithContent(JSON.stringify(global.FAIL_OK_RESPONSE), httpResponse) } - respondWithContent(JSON.stringify(customResponse), httpResponse) } async function doGit() { @@ -671,8 +671,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE maxConcurrentProcesses: 6, } const git = simpleGit(options) - - return await git.checkoutBranch(currentBranch) + console.log('checkout ' + currentBranch) + try { + await git.checkoutBranch(currentBranch) + } catch (err) { + return false + } + return true } } catch (err) { diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 3da8b4def..22298ad47 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -186,13 +186,13 @@ function newSuperalgosDocSpace() { function changeActiveBranch(branch) { window.localStorage.setItem('Current Branch', UI.projects.superalgos.spaces.docsSpace.currentBranch) - httpRequest(undefined, 'App/Checkout/' + UI.projects.superalgos.spaces.docsSpace.currentBranch, onResponse) + httpRequest(undefined, 'App/Checkout/' + branch, onResponse) UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Changing Current Branch') function onResponse(err, data) { /* Lets check the result of the call through the http interface */ data = JSON.parse(data) - if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.CUSTOM_OK_RESPONSE.result) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { UI.projects.superalgos.spaces.docsSpace.currentBranch = branch UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Switching Branches - Current Branch Changed') } else {