feat (be podcast): fe connected to be, trying to download podcast episode, save it in cc_files and updating podcast_episodes
This commit is contained in:
parent
2fcde13ef5
commit
2dae6e07e7
10 changed files with 183 additions and 41 deletions
|
@ -14,6 +14,7 @@ podcastStore.loadPodcast(basePodcast());
|
|||
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = podcast_page();
|
||||
const url = ref('');
|
||||
const itemEdited = ref(basePodcast());
|
||||
const episodes = ref([]);
|
||||
const bulk = ref(false);
|
||||
const dialog = reactive({
|
||||
open: false,
|
||||
|
@ -21,6 +22,7 @@ const dialog = reactive({
|
|||
title: '',
|
||||
text: ''
|
||||
});
|
||||
const dialogLoading = ref(false);
|
||||
|
||||
const openDialog = (type, title = '', text = '', bulk = false) => {
|
||||
dialog.open = true
|
||||
|
@ -47,12 +49,22 @@ const confirm = (confirm, bulk) => {
|
|||
}
|
||||
}
|
||||
|
||||
const confirmAdd = (confirm) => {
|
||||
const confirmAdd = async (confirm) => {
|
||||
if (confirm) {
|
||||
podcastStore.updateField({key: 'url', value: url});
|
||||
console.log(podcastStore);
|
||||
dialogLoading.value = true;
|
||||
await axios.get('/rss_podcast_load', {
|
||||
params: {
|
||||
url: url.value,
|
||||
}
|
||||
}).then(res => {
|
||||
podcastStore.updateField({key: 'title', value: res.data.podcast.title});
|
||||
podcastStore.updateField({key: 'url', value: url});
|
||||
podcastStore.currentPodcastEpisodes = res.data.episodes;
|
||||
//episodes.value = res.data.episodes;
|
||||
closeDialog();
|
||||
dialogLoading.value = false;
|
||||
})
|
||||
}
|
||||
closeDialog()
|
||||
}
|
||||
|
||||
const edit = (item) => {
|
||||
|
@ -60,42 +72,46 @@ const edit = (item) => {
|
|||
}
|
||||
|
||||
const cancel = (item) => {
|
||||
bulk.value = Array.isArray(item)
|
||||
itemEdited.value = item
|
||||
bulk.value = Array.isArray(item);
|
||||
itemEdited.value = item;
|
||||
openDialog(
|
||||
'delete',
|
||||
'Cancella',
|
||||
bulk.value ? 'Vuoi cancellare i podcast selezionati?' : 'Vuoi cancellare il podcast selezionato?'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const confirmDelete = (confirm, bulk) => {
|
||||
if (confirm) {
|
||||
if (!bulk) {
|
||||
deleteItem(itemEdited.value.id)
|
||||
deleteItem(itemEdited.value.id);
|
||||
} else {
|
||||
itemEdited.value.forEach(el => {
|
||||
deleteItem(el.id)
|
||||
deleteItem(el.id);
|
||||
})
|
||||
}
|
||||
}
|
||||
closeDialog()
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
const closeDialog = () => {
|
||||
dialog.open = false
|
||||
dialog.open = false;
|
||||
itemEdited.value = basePodcast();
|
||||
}
|
||||
|
||||
const updateSearch = (text) => {
|
||||
search.value = text
|
||||
search.value = text;
|
||||
}
|
||||
|
||||
const resetItemEdited = () => {
|
||||
podcastStore.currentPodcast = basePodcast();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PodcastEditor
|
||||
v-if="podcastStore.currentPodcast.url != '' && podcastStore.currentPodcast.url != null"
|
||||
@go-back="podcastStore.currentPodcast = basePodcast()"
|
||||
@go-back="resetItemEdited"
|
||||
/>
|
||||
<Table
|
||||
v-else
|
||||
|
@ -126,6 +142,7 @@ const updateSearch = (text) => {
|
|||
:bulk="bulk"
|
||||
@confirm="confirm"
|
||||
@after-leave="closeDialog"
|
||||
:loading="dialogLoading"
|
||||
>
|
||||
<VTextField
|
||||
label="Feed RSS"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue