mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
Displaying confirmation modal when deleting tagged files, rather than just refusing to delete them.
This commit is contained in:
parent
4380cab88c
commit
8fb9e35aef
7 changed files with 133 additions and 55 deletions
|
|
@ -1386,10 +1386,18 @@ export async function getFile(path, skipTracking = false) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function deleteFile(paths) {
|
||||
let body = {paths: paths};
|
||||
export async function deleteFile(paths, force = false) {
|
||||
let body = {paths: paths, force: force};
|
||||
const response = await apiPost(`${API_URI}/files/delete`, body);
|
||||
if (!response.ok) {
|
||||
try {
|
||||
const json = await response.clone().json();
|
||||
if (json.code === 'FILE_GROUP_IS_TAGGED' && json.file_groups) {
|
||||
return {tagged: true, file_groups: json.file_groups};
|
||||
}
|
||||
} catch (e) {
|
||||
// Not JSON, fall through to generic error.
|
||||
}
|
||||
const message = await getErrorMessage(response, 'Failed to delete file. See server logs.');
|
||||
toast({
|
||||
type: 'error',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue