From 973cd345cdfc3fc51f538352c5472297182eb678 Mon Sep 17 00:00:00 2001 From: Vedant K Date: Wed, 7 Apr 2021 12:22:31 +0530 Subject: [PATCH] fix(spinner): hide spinner while printing access token expiry time Signed-off-by: Vedant K --- src/utils.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils.js b/src/utils.js index 16612c4..b6c6fc3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -115,6 +115,8 @@ exports.generateBodyAndHeaders = async (drive) => { // A helper function to regenerate the access token in case // it has expired exports.refreshAccessToken = async (drive) => { + // Stop loading + const spinnerText = this.stopSpin() // The provider config let providerConfigJson = await axios.get( 'https://dabbu-knowledge-platform.github.io/schema/provider-fields.json' @@ -207,13 +209,13 @@ exports.refreshAccessToken = async (drive) => { this.get(`drives.${drive}.${providerConfig.auth.path}.expires-at`) ).toLocaleString()}` ) - // Return successfully - } else { - // If it is not expired, return successfully } - } else { - // If there is no auth required for that provider, return successfully + // If it is not expired, return successfully } + + // If there is no auth required for that provider, return successfully + // Before returning, resume loading + this.startSpin(spinnerText) } // Return an absolute path based on the current path in