mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: restore message toast after playlist deletion
This commit is contained in:
parent
6f6f9a0839
commit
f0f953568c
2 changed files with 5 additions and 3 deletions
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<TransitionGroup name="toast" tag="ul">
|
||||
<li v-for="message in messages" :key="message.id">
|
||||
<MessageToastItem :message="message" @dismiss="removeMessage(message)"/>
|
||||
<MessageToast :message="message" @dismiss="removeMessage(message)"/>
|
||||
</li>
|
||||
</TransitionGroup>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import MessageToastItem from '@/components/ui/MessageToastItem.vue'
|
||||
import MessageToast from '@/components/ui/MessageToast.vue'
|
||||
|
||||
const messages = ref<ToastMessage[]>([])
|
||||
|
||||
|
|
|
@ -11,14 +11,16 @@ import router from '@/router'
|
|||
import { authService } from '@/services'
|
||||
import { playlistStore, preferenceStore, userStore } from '@/stores'
|
||||
import { eventBus, forceReloadWindow, requireInjection } from '@/utils'
|
||||
import { DialogBoxKey } from '@/symbols'
|
||||
import { DialogBoxKey, MessageToasterKey } from '@/symbols'
|
||||
|
||||
const toaster = requireInjection(MessageToasterKey)
|
||||
const dialog = requireInjection(DialogBoxKey)
|
||||
|
||||
eventBus.on({
|
||||
'PLAYLIST_DELETE': async (playlist: Playlist) => {
|
||||
if (await dialog.value.confirm(`Are you sure you want to delete "${playlist.name}"?`, 'Delete Playlist')) {
|
||||
await playlistStore.delete(playlist)
|
||||
toaster.value.success(`Playlist "${playlist.name}" deleted.`)
|
||||
router.go('home')
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue