chore(files_sharing): use spawnDialog for new file request handler

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
skjnldsv 2024-07-31 09:28:25 +02:00 committed by nextcloud-command
parent 8b238a2d76
commit 528134b46b

View file

@ -4,15 +4,16 @@
*/
import type { Entry, Folder, Node } from '@nextcloud/files'
import { defineAsyncComponent } from 'vue'
import { spawnDialog } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import FileUploadSvg from '@mdi/svg/svg/file-upload.svg?raw'
import Vue, { defineAsyncComponent } from 'vue'
import Config from '../services/ConfigService'
const sharingConfig = new Config()
const NewFileRequestDialogVue = defineAsyncComponent(() => import('../components/NewFileRequestDialog.vue'))
const sharingConfig = new Config()
export const EntryId = 'file-request'
export const entry = {
@ -25,29 +26,9 @@ export const entry = {
return sharingConfig.isPublicShareAllowed
},
async handler(context: Folder, content: Node[]) {
// Create document root
const mountingPoint = document.createElement('div')
mountingPoint.id = 'file-request-dialog'
document.body.appendChild(mountingPoint)
// Init vue app
const NewFileRequestDialog = new Vue({
name: 'NewFileRequestDialogRoot',
render: (h) => h(
NewFileRequestDialogVue,
{
props: {
context,
content,
},
on: {
close: () => {
NewFileRequestDialog.$destroy()
},
},
},
),
el: mountingPoint,
spawnDialog(NewFileRequestDialogVue, {
context,
content,
})
},
} as Entry