Skip to content

Commit f3159bc

Browse files
committed
Fix prop modification error
1 parent d663034 commit f3159bc

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

resources/assets/scripts/components/server/components/filemanager/modals/DeleteFileModal.vue

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Modal :show="visible" v-on:close="visible = false">
2+
<Modal :show="isVisible" v-on:close="isVisible = false">
33
<MessageBox
44
class="alert error mb-8"
55
title="Error"
@@ -12,7 +12,7 @@
1212
Deletion is a permanent operation: <strong>{{ object.name }}</strong><span v-if="object.directory">, as well as its contents,</span> will be removed immediately.
1313
</p>
1414
<div class="mt-8 text-right">
15-
<button class="btn btn-secondary btn-sm" v-on:click.prevent="visible = false">Cancel</button>
15+
<button class="btn btn-secondary btn-sm" v-on:click.prevent="isVisible = false">Cancel</button>
1616
<button class="btn btn-red btn-sm ml-2" v-on:click="deleteItem" :disabled="isLoading">
1717
<span v-if="isLoading" class="spinner white">&nbsp;</span>
1818
<span v-else>Yes, Delete</span>
@@ -30,6 +30,7 @@
3030
import {mapState} from "vuex";
3131
import {AxiosError} from "axios";
3232
import { join } from 'path';
33+
import {ApplicationState} from '@/store/types';
3334
3435
type DataStructure = {
3536
isLoading: boolean,
@@ -45,12 +46,6 @@
4546
object: { type: Object as () => DirectoryContentObject, required: true }
4647
},
4748
48-
watch: {
49-
visible: function (value: boolean) {
50-
this.$emit('update:visible', value);
51-
},
52-
},
53-
5449
data: function (): DataStructure {
5550
return {
5651
isLoading: false,
@@ -59,14 +54,29 @@
5954
},
6055
6156
computed: {
62-
...mapState('server', ['fm', 'server', 'credentials']),
57+
...mapState({
58+
server: (state: ApplicationState) => state.server.server,
59+
credentials: (state: ApplicationState) => state.server.credentials,
60+
fm: (state: ApplicationState) => state.server.fm,
61+
}),
62+
63+
isVisible: {
64+
get: function (): boolean {
65+
return this.visible;
66+
},
67+
set: function (value: boolean) {
68+
this.$emit('update:visible', value);
69+
},
70+
},
6371
},
6472
6573
methods: {
6674
deleteItem: function () {
6775
this.isLoading = true;
6876
77+
// @ts-ignore
6978
deleteElement(this.server.uuid, this.credentials, [
79+
// @ts-ignore
7080
join(this.fm.currentDirectory, this.object.name)
7181
])
7282
.then(() => this.$emit('deleted'))

0 commit comments

Comments
 (0)