cleanup, get import response message
This commit is contained in:
parent
02a134ad1e
commit
6e036820eb
@ -360,7 +360,6 @@
|
|||||||
|
|
||||||
<Modal :show="showImportModal" title="Import Playlist" :modal-action="importPlaylist">
|
<Modal :show="showImportModal" title="Import Playlist" :modal-action="importPlaylist">
|
||||||
<input
|
<input
|
||||||
ref="fileImport"
|
|
||||||
type="file"
|
type="file"
|
||||||
class="file-input file-input-sm file-input-bordered w-full"
|
class="file-input file-input-sm file-input-bordered w-full"
|
||||||
v-on:change="onFileChange"
|
v-on:change="onFileChange"
|
||||||
@ -406,7 +405,6 @@ useHead({
|
|||||||
const { configID } = storeToRefs(useConfig())
|
const { configID } = storeToRefs(useConfig())
|
||||||
const { listDate } = storeToRefs(usePlaylist())
|
const { listDate } = storeToRefs(usePlaylist())
|
||||||
|
|
||||||
const fileImport = ref()
|
|
||||||
const todayDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
const todayDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
||||||
const targetDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
const targetDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
||||||
const editId = ref(-1)
|
const editId = ref(-1)
|
||||||
@ -505,15 +503,6 @@ function setCategory(event: any, item: PlaylistItem) {
|
|||||||
item.category = ''
|
item.category = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onFileChange(evt: any) {
|
|
||||||
const files = evt.target.files || evt.dataTransfer.files
|
|
||||||
|
|
||||||
if (!files.length) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
textFile.value = files
|
|
||||||
}
|
|
||||||
|
|
||||||
function addBG(obj: any) {
|
function addBG(obj: any) {
|
||||||
if (obj.item) {
|
if (obj.item) {
|
||||||
@ -715,6 +704,16 @@ function loopClips() {
|
|||||||
playlistStore.playlist = processPlaylist(configStore.startInSec, configStore.playlistLength, tempList, false)
|
playlistStore.playlist = processPlaylist(configStore.startInSec, configStore.playlistLength, tempList, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFileChange(evt: any) {
|
||||||
|
const files = evt.target.files || evt.dataTransfer.files
|
||||||
|
|
||||||
|
if (!files.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
textFile.value = files
|
||||||
|
}
|
||||||
|
|
||||||
async function importPlaylist(imp: boolean) {
|
async function importPlaylist(imp: boolean) {
|
||||||
showImportModal.value = false
|
showImportModal.value = false
|
||||||
|
|
||||||
@ -737,8 +736,8 @@ async function importPlaylist(imp: boolean) {
|
|||||||
body: formData,
|
body: formData,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then((response) => {
|
||||||
indexStore.msgAlert('success', 'Import success!', 2)
|
indexStore.msgAlert('success', response, 2)
|
||||||
playlistStore.getPlaylist(listDate.value)
|
playlistStore.getPlaylist(listDate.value)
|
||||||
})
|
})
|
||||||
.catch((e: string) => {
|
.catch((e: string) => {
|
||||||
@ -748,7 +747,6 @@ async function importPlaylist(imp: boolean) {
|
|||||||
|
|
||||||
playlistStore.isLoading = false
|
playlistStore.isLoading = false
|
||||||
textFile.value = null
|
textFile.value = null
|
||||||
fileImport.value.value = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function savePlaylist(save: boolean) {
|
async function savePlaylist(save: boolean) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user