fix(ui): expose public channel upload form methods
This commit also returns a function removed during Vue 3 rewrite. (in 1c395c01b0
)
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2307>
This commit is contained in:
parent
943b50ffda
commit
66473084eb
|
@ -399,6 +399,34 @@ watchEffect(() => {
|
||||||
const labels = computed(() => ({
|
const labels = computed(() => ({
|
||||||
editTitle: t('components.channels.UploadForm.button.edit')
|
editTitle: t('components.channels.UploadForm.button.edit')
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const publish = async () => {
|
||||||
|
isLoading.value = true
|
||||||
|
|
||||||
|
errors.value = []
|
||||||
|
|
||||||
|
try {
|
||||||
|
await axios.post('uploads/action/', {
|
||||||
|
action: 'publish',
|
||||||
|
objects: uploadedFiles.value.map((file) => file.response?.uuid)
|
||||||
|
})
|
||||||
|
|
||||||
|
store.commit('channels/publish', {
|
||||||
|
uploads: uploadedFiles.value.map((file) => ({ ...file.response, import_status: 'pending' })),
|
||||||
|
channel: selectedChannel.value
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
errors.value = (error as BackendError).backendErrors
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
step,
|
||||||
|
publish
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue