I need to find whether current user is a site owner in spfx react . Please find below code which I am using right now
const ownerGroupId = (await sp.web.associatedOwnerGroup()).Id
const users = await sp.web.siteGroups.getById(ownerGroupId).users();
await sp.web.currentUser.get().then(async(user) => {
if(users.some(r=>r.Id==user.Id))
{
console.log("Site Owner")
}
});
But problem I am facing is in site owner groups is having groups which current user is part of. I need to compare the users who are nested inside site owner groups. any helps will be highly appreciated