Closed lata-11 closed 11 months ago
The code doesn't fix any bug or add new feature. It minimize promise chaining in asynchronous functions. Replaced .then with “async - await” wherever possible.
Please describe the changes in your pull request in few words here.
Before: const fetchVersion = () => { return getFossologyVersion() .then((res) => { setSessionStorage("fossologyVersion", res); setVersion(res); return res; }) .catch(() => null); }; After: const fetchVersion = async () => { try { const res = await getFossologyVersion(); setSessionStorage("fossologyVersion", res); setVersion(res); return res; } catch (error) { return null; } };
Please consider using the closing keyword if the pull request is proposed to fix an issue already created in the repository closes #261 (https://help.github.com/articles/closing-issues-using-keywords/)
Description
The code doesn't fix any bug or add new feature. It minimize promise chaining in asynchronous functions. Replaced .then with “async - await” wherever possible.
Please describe the changes in your pull request in few words here.
Changes
Before: const fetchVersion = () => { return getFossologyVersion() .then((res) => { setSessionStorage("fossologyVersion", res); setVersion(res); return res; }) .catch(() => null); }; After: const fetchVersion = async () => { try { const res = await getFossologyVersion(); setSessionStorage("fossologyVersion", res); setVersion(res); return res; } catch (error) { return null; } };
Please consider using the closing keyword if the pull request is proposed to fix an issue already created in the repository closes #261 (https://help.github.com/articles/closing-issues-using-keywords/)