Closed pulkit-30 closed 1 year ago
fix: #216
Minimize promise chaining in asynchronous functions. replaced .then with “async - await” wherever possible.
.then
Example changes in src/components/Footer/index.jsx file:
src/components/Footer/index.jsx
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; } };
@GMishx please review this PR
@pulkit-30 , please squash the commits into 1 commit and change the commit message as per the contributing guidelines.
@Shruti3004 , please review this branch.
fix: #216
Description
Minimize promise chaining in asynchronous functions. replaced
.then
with “async - await” wherever possible.Changes
Example changes in
src/components/Footer/index.jsx
file:Before
After