From db687d3274fa43524be79f9e53f3a9405a1e9556 Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <konrad.mohrfeldt@farbdev.org> Date: Tue, 28 May 2024 11:49:40 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20don=E2=80=99t=20throw=20unhandled=20erro?= =?UTF-8?q?rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/playlist/APlaylistEditor.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/playlist/APlaylistEditor.vue b/src/components/playlist/APlaylistEditor.vue index 99d5b3fd..61b85df3 100644 --- a/src/components/playlist/APlaylistEditor.vue +++ b/src/components/playlist/APlaylistEditor.vue @@ -138,20 +138,20 @@ </div> <APermissionGuard show-permissions="program.add__stream"> - <GetStreamUrl v-slot="{ resolve, reject }"> - <AStreamURLDialog @save="resolve($event)" @close="reject(undefined)" /> + <GetStreamUrl v-slot="{ resolve }"> + <AStreamURLDialog @save="resolve($event)" @close="resolve(null)" /> </GetStreamUrl> </APermissionGuard> <APermissionGuard show-permissions="program.add__import"> - <GetFileImportUrl v-slot="{ resolve, reject }"> - <AFileUrlDialog @save="resolve($event)" @close="reject(undefined)" /> + <GetFileImportUrl v-slot="{ resolve }"> + <AFileUrlDialog @save="resolve($event)" @close="resolve(null)" /> </GetFileImportUrl> </APermissionGuard> <APermissionGuard show-permissions="program.add__line"> - <GetInputUrl v-slot="{ resolve, reject }"> - <AInputUrlDialog @save="resolve($event)" @close="reject(undefined)" /> + <GetInputUrl v-slot="{ resolve }"> + <AInputUrlDialog @save="resolve($event)" @close="resolve(null)" /> </GetInputUrl> </APermissionGuard> </template> @@ -198,9 +198,9 @@ const { t } = useI18n() const fileStore = useFilesStore() const playlistStore = usePlaylistStore() -const GetStreamUrl = createTemplatePromise<string>() -const GetFileImportUrl = createTemplatePromise<string>() -const GetInputUrl = createTemplatePromise<string>() +const GetStreamUrl = createTemplatePromise<string | null>() +const GetFileImportUrl = createTemplatePromise<string | null>() +const GetInputUrl = createTemplatePromise<string | null>() const entries = useCopy(() => props.playlist?.entries ?? [], { save: () => updatePlaylistEntries(), @@ -287,6 +287,7 @@ async function uploadFiles(files: File[]) { async function importFileFromURL() { const fileUrl = await GetFileImportUrl.start() + if (!fileUrl) return const tankFile = await fileStore.importFileURL(fileUrl, props.show, { onDone: (tankFile) => uploadedFiles.value.delete(tankFile.id), onCreate: (tankFile) => { @@ -313,11 +314,13 @@ async function addFileToPlaylist(...files: TankFile[]) { async function addStreamToPlaylist() { const streamURL = await GetStreamUrl.start() + if (!streamURL) return await updatePlaylistEntries({ uri: streamURL }) } async function addInputToPlaylist() { const inputUrl = await GetInputUrl.start() + if (!inputUrl) return await updatePlaylistEntries({ uri: inputUrl }) } -- GitLab