feat: automatically jump to the next photo when deleting while previewing (#1143)

This commit is contained in:
Matt Doyle
2020-11-23 13:08:14 -05:00
committed by GitHub
parent e8b4e9af46
commit 9515ceeb42
2 changed files with 20 additions and 6 deletions

View File

@@ -20,7 +20,6 @@
<script>
import {mapGetters, mapMutations, mapState} from 'vuex'
import { files as api } from '@/api'
import url from '@/utils/url'
import buttons from '@/utils/buttons'
export default {
@@ -32,17 +31,20 @@ export default {
methods: {
...mapMutations(['closeHovers']),
submit: async function () {
this.closeHovers()
buttons.loading('delete')
try {
if (!this.isListing) {
await api.remove(this.$route.path)
buttons.success('delete')
this.$router.push({ path: url.removeLastDir(this.$route.path) + '/' })
this.$root.$emit('preview-deleted')
this.closeHovers()
return
}
this.closeHovers()
if (this.selectedCount === 0) {
return
}