feat: import test cases UI using Excel (#339)

This commit is contained in:
kimatata
2025-11-22 10:32:18 +09:00
committed by GitHub
parent 7db464e28b
commit b986f39c42
13 changed files with 263 additions and 76 deletions

View File

@@ -235,4 +235,25 @@ async function exportCases(jwt: string, folderId: number, type: string) {
}
}
export { fetchCase, fetchCases, updateCase, createCase, deleteCases, cloneCases, exportCases };
async function importCases(jwt: string, folderId: number, file: File) {
const url = `${apiServer}/cases/import?folderId=${folderId}`;
const formData = new FormData();
formData.append('file', file);
try {
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: `Bearer ${jwt}`,
},
body: formData,
});
const data = await response.json();
return data;
} catch (error: unknown) {
logError('Error importing data', error);
}
}
export { fetchCase, fetchCases, updateCase, createCase, deleteCases, cloneCases, exportCases, importCases };