copy files

This commit is contained in:
2025-07-30 23:35:30 +02:00
parent 956c0c6f65
commit ea09b9c470
21 changed files with 552 additions and 46 deletions

View File

@@ -335,3 +335,38 @@ export async function moveFile(
success: true,
};
}
export async function copyFile(
warrenId: string,
currentPath: string,
targetPath: string
): Promise<{ success: boolean }> {
const { status } = await useFetch(getApiUrl(`warrens/files/cp`), {
method: 'POST',
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path: currentPath,
targetPath: targetPath,
}),
});
if (status.value !== 'success') {
toast.error('Copy', {
id: 'COPY_FILE_TOAST',
description: `Failed to copy file`,
});
return { success: false };
}
await refreshNuxtData('current-directory');
toast.success('Copy', {
id: 'COPY_FILE_TOAST',
description: `Successfully copied file`,
});
return {
success: true,
};
}