refactor: make function name more descriptive

This commit is contained in:
Akuoko Daniel Jnr 2020-12-24 23:52:34 +00:00
parent 9366266c3e
commit a332964d73
No known key found for this signature in database
GPG Key ID: 1C95803CACD3E9DC
3 changed files with 5 additions and 6 deletions

View File

@ -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 }),

View File

@ -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);
}

View File

@ -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);
}