From 39bffd27900f3bcfeca50493922fadb94b5ee74e Mon Sep 17 00:00:00 2001 From: jonath92 <49979415+jonath92@users.noreply.github.com> Date: Fri, 28 Aug 2020 10:46:41 +0200 Subject: [PATCH] Regression: Fixed OneDrive synchronisation (#3674) --- ReactNativeClient/lib/onedrive-api.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ReactNativeClient/lib/onedrive-api.js b/ReactNativeClient/lib/onedrive-api.js index 33b41863c..611c10f94 100644 --- a/ReactNativeClient/lib/onedrive-api.js +++ b/ReactNativeClient/lib/onedrive-api.js @@ -327,22 +327,15 @@ class OneDriveApi { } async execAccountPropertiesRequest() { - const response = await shim.fetch('https://graph.microsoft.com/v1.0/me/drive', { - method: 'GET', - headers: { - 'Authorization': this.token(), - }, - }); - if (!response.ok) { - const text = await response.text(); - throw new Error(`Could not retrieve account details (drive ID, Account type): ${response.status}: ${response.statusText}: ${text}`); - } else { + try { + const response = await this.exec('GET','https://graph.microsoft.com/v1.0/me/drive'); const data = await response.json(); const accountProperties = { accountType: data.driveType, driveId: data.id }; return accountProperties; + } catch (error) { + throw new Error(`Could not retrieve account details (drive ID, Account type. Error code: ${error.code}, Error message: ${error.message}`); } - } async execJson(method, path, query, data) {