You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
feat: share management delete confirm (#1212)
This commit is contained in:
@@ -19,6 +19,7 @@ import Replace from './Replace'
|
||||
import ReplaceRename from './ReplaceRename'
|
||||
import Share from './Share'
|
||||
import Upload from './Upload'
|
||||
import ShareDelete from './ShareDelete'
|
||||
import { mapState } from 'vuex'
|
||||
import buttons from '@/utils/buttons'
|
||||
|
||||
@@ -37,7 +38,8 @@ export default {
|
||||
Help,
|
||||
Replace,
|
||||
ReplaceRename,
|
||||
Upload
|
||||
Upload,
|
||||
ShareDelete
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
@@ -91,7 +93,8 @@ export default {
|
||||
'replace',
|
||||
'replace-rename',
|
||||
'share',
|
||||
'upload'
|
||||
'upload',
|
||||
'share-delete'
|
||||
].indexOf(this.show) >= 0;
|
||||
|
||||
return matched && this.show || null;
|
||||
|
||||
47
frontend/src/components/prompts/ShareDelete.vue
Normal file
47
frontend/src/components/prompts/ShareDelete.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div class="card floating">
|
||||
<div class="card-content">
|
||||
<p>{{ $t('prompts.deleteMessageShare', {path: hash.path}) }}</p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<button @click="$store.commit('closeHovers')"
|
||||
class="button button--flat button--grey"
|
||||
:aria-label="$t('buttons.cancel')"
|
||||
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
|
||||
<button @click="submit"
|
||||
class="button button--flat button--red"
|
||||
:aria-label="$t('buttons.delete')"
|
||||
:title="$t('buttons.delete')">{{ $t('buttons.delete') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapMutations, mapState} from 'vuex'
|
||||
import { share as api } from '@/api'
|
||||
import buttons from '@/utils/buttons'
|
||||
|
||||
export default {
|
||||
name: 'share-delete',
|
||||
computed: {
|
||||
...mapState(['hash'])
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['closeHovers']),
|
||||
submit: async function () {
|
||||
buttons.loading('delete')
|
||||
|
||||
try {
|
||||
await api.remove(this.hash.hash)
|
||||
buttons.success('delete')
|
||||
|
||||
this.$root.$emit('share-deleted', this.hash.hash)
|
||||
this.closeHovers()
|
||||
} catch (e) {
|
||||
buttons.done('delete')
|
||||
this.$showError(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user