fossology / FOSSologyUI

Repository to hold the new UI framework for FOSSology built with React
https://fossology.github.io/FOSSologyUI/
GNU General Public License v2.0
47 stars 85 forks source link

Lata 11/fix/261 #282

Closed lata-11 closed 9 months ago

lata-11 commented 9 months ago

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/)