Clone test cases UI (#302)

This commit is contained in:
kimatata
2025-10-19 17:09:09 +09:00
committed by GitHub
parent 9ba1f3f1f8
commit 7c1dfd49b9
11 changed files with 217 additions and 29 deletions

View File

@@ -169,6 +169,28 @@ async function deleteCases(jwt: string, deleteCaseIds: number[], projectId: numb
}
}
async function cloneCases(jwt: string, moveCaseIds: number[], targetFolderId: number, projectId: number) {
const fetchOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${jwt}`,
},
body: JSON.stringify({ caseIds: moveCaseIds, targetFolderId }),
};
const url = `${apiServer}/cases/clone?projectId=${projectId}`;
try {
const response = await fetch(url, fetchOptions);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error: unknown) {
logError('Error cloning project', error);
}
}
async function exportCases(jwt: string, folderId: number, type: string) {
if (type !== 'json' && type !== 'csv') {
console.error('export type error. type:', type);
@@ -202,4 +224,4 @@ async function exportCases(jwt: string, folderId: number, type: string) {
}
}
export { fetchCase, fetchCases, updateCase, createCase, deleteCases, exportCases };
export { fetchCase, fetchCases, updateCase, createCase, deleteCases, cloneCases, exportCases };