Skip to content

Commit

Permalink
Add redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Mar 11, 2023
1 parent 02760fc commit 0f8ce64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Controller/Admin/FileStorageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$fileStorage = $this->FileStorage->get($id);
$redirect = $this->request->getQuery('redirect');
if ($this->FileStorage->delete($fileStorage)) {
$this->Flash->success(__('The file storage has been deleted.'));
} else {
$this->Flash->error(__('The file storage could not be deleted. Please, try again.'));
}

return $this->redirect(['action' => 'index']);
if ($redirect === 'ref') {
return $this->redirect($this->referer(['action' => 'index']));
}

return $this->redirect($redirect ?: ['action' => 'index']);
}
}

0 comments on commit 0f8ce64

Please sign in to comment.