Correct hasIdentity parentId extraction (#2884)

This commit is contained in:
Jaco Greeff
2020-11-29 16:08:39 +01:00
committed by GitHub
parent b652bdc2de
commit 90cc148383
2 changed files with 3 additions and 5 deletions
+3 -4
View File
@@ -107,12 +107,11 @@ export function hasIdentity (instanceId: string, api: ApiInterfaceRx): (accountI
api.derive.accounts._identityBase(accountId).pipe(
map(([identityOfOpt, superOfOpt]: [Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]): DeriveHasIdentity => {
const parentId = superOfOpt && superOfOpt.isSome
? superOfOpt.unwrap().toString()
? superOfOpt.unwrap()[0].toString()
: null;
const hasParent = !!parentId;
const hasIdentity = hasParent || !!(identityOfOpt && identityOfOpt.isSome);
const hasIdentity = !!parentId || !!(identityOfOpt && identityOfOpt.isSome);
return { hasIdentity, hasParent, parentId };
return { hasIdentity, parentId };
})
)
);
@@ -38,6 +38,5 @@ export interface DeriveAccountInfo {
export interface DeriveHasIdentity {
hasIdentity: boolean;
hasParent: boolean;
parentId: string | null;
}