Fix undefineds
This commit is contained in:
parent
ff10fa422b
commit
748b55c732
|
@ -28,9 +28,10 @@ export async function syncUser(ctx: Ctx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let previousApps = isUser(previousUser)
|
let previousApps =
|
||||||
? Object.keys(previousUser.roles).map(appId => appId)
|
previousUser && isUser(previousUser)
|
||||||
: []
|
? Object.keys(previousUser.roles).map(appId => appId)
|
||||||
|
: []
|
||||||
|
|
||||||
const roles = deleting ? {} : user.roles
|
const roles = deleting ? {} : user.roles
|
||||||
// remove props which aren't useful to metadata
|
// remove props which aren't useful to metadata
|
||||||
|
|
|
@ -70,6 +70,6 @@ export interface AdminUser extends User {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isUser(user: any): user is User {
|
export function isUser(user: object): user is User {
|
||||||
return !!(user as User).roles
|
return !!(user as User).roles
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue