-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui-api): update
importFile
function
- Loading branch information
Showing
4 changed files
with
28 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import client from "../../client"; | ||
import type { DownloadMatrixParams } from "./types"; | ||
import type { DownloadMatrixParams, ImportFileParams } from "./types"; | ||
|
||
export async function downloadMatrix(params: DownloadMatrixParams) { | ||
const { studyId, ...rest } = params; | ||
const { studyId, ...queryParams } = params; | ||
const url = `v1/studies/${studyId}/raw/download`; | ||
const res = await client.get<Blob>(url, { | ||
params: rest, | ||
params: queryParams, | ||
responseType: "blob", | ||
}); | ||
|
||
return res.data; | ||
} | ||
|
||
export async function importFile(params: ImportFileParams) { | ||
const { studyId, file, onUploadProgress, ...queryParams } = params; | ||
const url = `v1/studies/${studyId}/raw`; | ||
const body = { file }; | ||
await client.putForm<void>(url, body, { | ||
params: { | ||
...queryParams, | ||
create_missing: queryParams.createMissing, | ||
}, | ||
onUploadProgress, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters