From 2f924cc311fe704300593959fba286e914ed7830 Mon Sep 17 00:00:00 2001 From: samueljd Date: Tue, 3 Oct 2023 16:38:28 +0530 Subject: [PATCH] Fixed linting errors after web-version --- .../checkandDownloadObsImages.js | 2 +- .../ResourceUtils/DownloadCreateSBforHelps.js | 10 +++---- .../Resources/useReadLocalResources.js | 2 +- renderer/src/core/Login/handleJson.js | 2 +- renderer/src/core/editor/writeToFile.js | 30 +++++++++---------- .../src/core/projects/saveProjetcsMeta.js | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js b/renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js index 311a5cb7e..b27edb900 100644 --- a/renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js +++ b/renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js @@ -71,7 +71,7 @@ export const checkandDownloadObsImages = async () => { const obsImagePath = `${packageInfo.name}/common/${environment.OBS_IMAGE_DIR}`; const { data: exist } = await sbStorageList(obsImagePath); if (!exist) { - await createDirectory({path:obsImagePath}); + await createDirectory({ path: obsImagePath }); } const { data: filesInDir } = await sbStorageDownload(obsImagePath); console.log({ filesInDir }); diff --git a/renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js b/renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js index 98354f06d..83e5b13b5 100644 --- a/renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js +++ b/renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js @@ -153,10 +153,10 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa const { data: folderExist } = await sbStorageList(folder); console.log({ folderExist }); if (!folderExist) { - await createDirectory({path:folder}); + await createDirectory({ path: folder }); } // writing zip to local - await createDirectory({path:`${folder}/${projectResource?.name}.zip}`,payload: Buffer.from(blob)}); + await createDirectory({ path: `${folder}/${projectResource?.name}.zip}`, payload: Buffer.from(blob) }); // extract zip const { data: filecontent, error: fileContentError } = await sbStorageDownload(`${folder}/${projectResource?.name}.zip}`); @@ -170,10 +170,10 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa for (const key of keys) { const item = result.files[key]; if (item.dir) { - await createDirectory({path:`${folder}/${item.name}`}); + await createDirectory({ path: `${folder}/${item.name}` }); } else { const bufferContent = Buffer.from(await item.async('arraybuffer')); - await createDirectory({path:`${folder}/${item.name}`,payload: bufferContent}); + await createDirectory({ path: `${folder}/${item.name}`, payload: bufferContent }); } } @@ -181,7 +181,7 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa data.agOffline = true; data.meta = projectResource; data.lastUpdatedAg = moment().format(); - await createDirectory({path:`${folder}/${projectResource?.name}/metadata.json`, payload :JSON.stringify(data)}); + await createDirectory({ path: `${folder}/${projectResource?.name}/metadata.json`, payload: JSON.stringify(data) }); }).catch((err) => { console.log('DownloadCreateSBforHelps.js', 'failed to save yml metadata.json : ', err); }); diff --git a/renderer/src/components/Resources/useReadLocalResources.js b/renderer/src/components/Resources/useReadLocalResources.js index 8e802adc2..675603a79 100644 --- a/renderer/src/components/Resources/useReadLocalResources.js +++ b/renderer/src/components/Resources/useReadLocalResources.js @@ -33,7 +33,7 @@ export default async function readLocalResources(username, setSubMenuItems) { const parseData = []; const projectsDir = `${newPath}/${email}/resources`; const userResourceMetaPath = `${newPath}/${email}/resources`; - createDirectory({path:userResourceMetaPath}); + createDirectory({ path: userResourceMetaPath }); readResourceMetadata(projectsDir, userResourceMetaPath, setSubMenuItems, parseData); } } diff --git a/renderer/src/core/Login/handleJson.js b/renderer/src/core/Login/handleJson.js index 5d9723f3e..7ffb33ffd 100644 --- a/renderer/src/core/Login/handleJson.js +++ b/renderer/src/core/Login/handleJson.js @@ -171,7 +171,7 @@ export const handleJsonWeb = async (values) => { }); console.log('handleJson.js', 'Successfully added new user to the existing list in file', { newUser }); - await createDirectory({path:`${newpath}/${values.email}/projects`}); + await createDirectory({ path: `${newpath}/${values.email}/projects` }); console.log('handleJson.js', 'Successfully created directories for new user'); // Add new user to localForage: diff --git a/renderer/src/core/editor/writeToFile.js b/renderer/src/core/editor/writeToFile.js index 3dbb9d64b..1af7f3740 100644 --- a/renderer/src/core/editor/writeToFile.js +++ b/renderer/src/core/editor/writeToFile.js @@ -30,21 +30,21 @@ const writeToFile = async ({ username, projectname, filename, data, }); if (!IsElectron) { - const filePath = `${newPath}/${username}/projects/${projectname}/${filename}`; - const { data: projectsPath, error } = await sbStorageDownload(filePath); - if (projectsPath) { - // appending to an existing file - console.log('writeToFile.js', 'Appending to the existing file'); - sbStorageUpdate({ path: filePath, payload: data }); - } else { - // Creating new file if nothing present - console.log('writeToFile.js', 'Creating new file to write'); - sbStorageUpload(filePath, data); - } - if (error) { - console.log(error); - } - } + const filePath = `${newPath}/${username}/projects/${projectname}/${filename}`; + const { data: projectsPath, error } = await sbStorageDownload(filePath); + if (projectsPath) { + // appending to an existing file + console.log('writeToFile.js', 'Appending to the existing file'); + sbStorageUpdate({ path: filePath, payload: data }); + } else { + // Creating new file if nothing present + console.log('writeToFile.js', 'Creating new file to write'); + sbStorageUpload(filePath, data); + } + if (error) { + console.log(error); + } + } }; export default writeToFile; diff --git a/renderer/src/core/projects/saveProjetcsMeta.js b/renderer/src/core/projects/saveProjetcsMeta.js index d61e7fb8c..27bfe8ff4 100644 --- a/renderer/src/core/projects/saveProjetcsMeta.js +++ b/renderer/src/core/projects/saveProjetcsMeta.js @@ -388,7 +388,7 @@ export const saveSupabaseProjectsMeta = async (projectMetaObj) => { const userProfile = await localforage.getItem('userProfile'); const currentUser = userProfile.user.email; const status = []; - await createDirectory({path:`${newPath}/${currentUser}/projects`}); + await createDirectory({ path: `${newPath}/${currentUser}/projects` }); const projectDir = `${newPath}/${currentUser}/projects}`; let projectNameExists = false; let checkCanon = false;