mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +03:00
refactor: make function name more descriptive
This commit is contained in:
parent
9366266c3e
commit
a332964d73
@ -300,7 +300,7 @@ export const getActivity = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getZipFilesPaths = async (data) => {
|
||||
export const getZipFilePaths = async (data) => {
|
||||
return await returnJSON(`api/zip/get-paths`, {
|
||||
...DEFAULT_OPTIONS,
|
||||
body: JSON.stringify({ data }),
|
||||
|
@ -256,7 +256,7 @@ export const download = (file) => {
|
||||
};
|
||||
|
||||
export const downloadZip = async (file) => {
|
||||
const { data } = await Actions.getZipFilesPaths(file);
|
||||
const { data } = await Actions.getZipFilePaths(file);
|
||||
const filesPaths = data.filesPaths.map((item) => item.replace(`/${file.id}/`, ""));
|
||||
const baseUrl = file.url;
|
||||
const zipFileName = file.file;
|
||||
@ -265,7 +265,7 @@ export const downloadZip = async (file) => {
|
||||
|
||||
for (let filePath of filesPaths) {
|
||||
let url = `${baseUrl}/${filePath}`;
|
||||
const blob = await Window.getBlob(url);
|
||||
const blob = await Window.getBlobFromUrl(url);
|
||||
|
||||
zip.file(filePath, blob);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ export const debounce = (func, wait) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const getBlob = async (url) => {
|
||||
export const getBlobFromUrl = async (url) => {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: new Headers({
|
||||
@ -127,8 +127,7 @@ export const getBlob = async (url) => {
|
||||
mode: "cors",
|
||||
});
|
||||
|
||||
const blob = response.blob();
|
||||
return blob;
|
||||
return response.blob();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user