diff --git a/src/services/logger.ts b/src/services/logger.ts new file mode 100644 index 00000000..20cde249 --- /dev/null +++ b/src/services/logger.ts @@ -0,0 +1,6 @@ +import { getLoggerBuilder } from '@nextcloud/logger' + +export const logger = getLoggerBuilder() + .setApp('guests') + .detectUser() + .build() \ No newline at end of file diff --git a/src/views/GuestForm.vue b/src/views/GuestForm.vue index 7ad9355e..d0fa57ec 100644 --- a/src/views/GuestForm.vue +++ b/src/views/GuestForm.vue @@ -78,6 +78,9 @@ import NcModal from '@nextcloud/vue/dist/Components/NcModal.js' import GroupSelect from '../components/GroupSelect.vue' import LanguageSelect from '../components/LanguageSelect.vue' +import { logger } from '../services/logger' +import { emit } from '@nextcloud/event-bus' + export default { name: 'GuestForm', components: { @@ -200,6 +203,7 @@ export default { this.loading = true try { + debugger await axios.put(generateOcsUrl('/apps/guests/api/v1/users'), { displayName: this.guest.fullName, email: this.guest.email, @@ -207,6 +211,9 @@ export default { groups: this.guest.groups, }) + logger.info('Creating aaaa share for guest', { guest: this.guest }) + console.log('HELLLOOOOO aaaa') + if (this.integrationApp === 'talk') { this.loading = false this.resolve({ @@ -216,6 +223,10 @@ export default { this.closeModal() return } + + + logger.info('Creating aaa ccccshare for guest', { guest: this.guest }) + console.log('HELLLOOOOO cccc aaaa') await this.addGuestShare() } catch ({ response }) { const error = response && response.data && response.data.ocs && response.data.ocs.data @@ -235,12 +246,23 @@ export default { const url = generateOcsUrl('/apps/files_sharing/api/v1/shares') const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/') + logger.info('Creating share for guest', { guest: this.guest }) + console.log('HELLLOOOOO') + const result = await axios.post(url + '?format=json', { shareType: OC.Share.SHARE_TYPE_USER, shareWith: this.guest.username, path, }) + this.$emit('add:share', result) + + this.$emit('files_sharing:external:add-share', result) + + emit('files_sharing:external:add-share', {}) + + logger.info('Creating share for guest : DONEEEEEE 1', { guest: this.guest }) + if (!result.data.ocs) { this.reject(result) }