Reload the files in the folder where the move happened

parent 59e1fbb6
......@@ -316,9 +316,9 @@
this.tableIsLoading = true;
this.queryServer({ folder_id: eventData.data.folder_id });
});
this.$events.listen('mediaWasUpdated', (eventData) => {
this.$events.listen('mediaWasMoved', (eventData) => {
this.tableIsLoading = true;
this.queryServer();
this.queryServer({ folder_id: eventData.data.folder_id });
});
},
};
......
......@@ -58,7 +58,7 @@
message: response.data.message,
});
this.dialogFormVisible = false;
this.$events.emit('mediaWasUpdated', response);
this.$events.emit('mediaWasMoved', response);
});
},
closeDialog() {
......
......@@ -27,15 +27,15 @@ class MoveMediaController extends Controller
public function __invoke(Request $request)
{
$destination = $this->folder->findFolder($request->get('destinationFolder'));
if ($destination === null) {
$destination = $this->makeRootFolder();
}
foreach ($request->get('files') as $file) {
$file = $this->file->find($file['id']);
if ($file->is_folder === false) {
$destination = $this->folder->findFolder($request->get('destinationFolder'));
if ($destination === null) {
$destination = $this->makeRootFolder();
}
$this->file->move($file, $destination);
}
}
......@@ -43,6 +43,7 @@ class MoveMediaController extends Controller
return response()->json([
'errors' => false,
'message' => 'Files moved successfully',
'folder_id' => $destination->id,
]);
}
......
......@@ -103121,9 +103121,9 @@ exports.default = {
_this4.tableIsLoading = true;
_this4.queryServer({ folder_id: eventData.data.folder_id });
});
this.$events.listen('mediaWasUpdated', function (eventData) {
this.$events.listen('mediaWasMoved', function (eventData) {
_this4.tableIsLoading = true;
_this4.queryServer();
_this4.queryServer({ folder_id: eventData.data.folder_id });
});
}
}; //
......@@ -104230,7 +104230,7 @@ exports.default = {
message: response.data.message
});
_this.dialogFormVisible = false;
_this.$events.emit('mediaWasUpdated', response);
_this.$events.emit('mediaWasMoved', response);
});
},
closeDialog: function closeDialog() {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment