add a condition if statement in try catch finally?


I want to add a condition if in my .finally but it doesnt work

(auth.user?.provider_id
            ? providerApi.get(auth.user?.provider_id).then(setProvider)
            : setProvider(null)
        ).finally(
            {
             if (auth.user?.diseases?.length) {
            if (limitedDiseases(auth.user.diseases)) {
                setDiseases([...auth.user.diseases]);
            } else {
                setDiseases([...auth.user.diseases, emptyDisease]);
            }
        }
            }
        );

Source: React – Stack Overflow

November 18, 2021
Category : News
Tags: conditional-statements | html | if-statement | javascript | reactjs

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.