diff --git a/src/components/playlist/APlaylistEditor.vue b/src/components/playlist/APlaylistEditor.vue index 99d5b3fd670ec01d9ceaae3c032317edb3d43964..61b85df3bca98e9056093071822041049fa806f3 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 }) }