From f9b1b196f142b027aa98d4e4a38600a0aa6016a9 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Tue, 2 Jul 2024 16:41:10 +0100 Subject: [PATCH] refactor(SharingSidebarView): Use NC logger & sort imports Signed-off-by: fenn-cs --- package-lock.json | 1 + package.json | 1 + src/client.js | 7 ++++--- src/components/SharingSidebarView.vue | 23 ++++++++++++----------- src/services/logger.ts | 6 ++++++ 5 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 src/services/logger.ts diff --git a/package-lock.json b/package-lock.json index aa6121c0a..c6b29839e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@nextcloud/files": "^3.1.1", "@nextcloud/initial-state": "^2.1.0", "@nextcloud/l10n": "^2.2.0", + "@nextcloud/logger": "^3.0.2", "@nextcloud/router": "^3.0.0", "@nextcloud/vue": "^8.12.0", "nextcloud-server": "^0.15.10", diff --git a/package.json b/package.json index 09a94b725..d415e8d91 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "@nextcloud/files": "^3.1.1", "@nextcloud/initial-state": "^2.1.0", "@nextcloud/l10n": "^2.2.0", + "@nextcloud/logger": "^3.0.2", "@nextcloud/router": "^3.0.0", "@nextcloud/vue": "^8.12.0", "nextcloud-server": "^0.15.10", diff --git a/src/client.js b/src/client.js index dcd9576c2..e1a44d69b 100644 --- a/src/client.js +++ b/src/client.js @@ -22,6 +22,7 @@ import ACL_PROPERTIES from './model/Properties.js' import Rule from './model/Rule.js' +import logger from './services/logger.ts' /** * @member {OC.Files.Client} client @@ -263,16 +264,16 @@ class AclDavService { return response } else if (response.status === 403) { // Handle permission denied scenario - console.error('Permission denied:', response.status, response.statusText) + logger.error('Permission denied:', { responseStatus: response.status, responseStatusText: response.statusText }) throw new Error(t('groupfolders', 'Permission denied. User does not have sufficient permissions.')) } else { // Handle unexpected status codes - console.error('Unexpected status:', response.status, response.statusText) + logger.error('Unexpected status:', { responseStatus: response.status, responseStatusText: response.statusText }) throw new Error(t('groupfolders', 'Unexpected status from server')) } }).catch(error => { // Handle network errors or exceptions - console.error('Error in propPatch:', error) + logger.error('Error in propPatch:', { error }) throw error }) } diff --git a/src/components/SharingSidebarView.vue b/src/components/SharingSidebarView.vue index bdaff4ac7..51583acb9 100644 --- a/src/components/SharingSidebarView.vue +++ b/src/components/SharingSidebarView.vue @@ -172,20 +172,21 @@