Add check for activeRole

This commit is contained in:
Khalid Adil 2023-07-12 19:45:18 -05:00
parent 46202b4f3a
commit 9ebe21eb5b

View File

@ -116,8 +116,6 @@ export default {
this.indicator.text(pollQuestion?.question || ''); this.indicator.text(pollQuestion?.question || '');
}, },
async fetchMyStatus() { async fetchMyStatus() {
const activeRole = await this.openmct.user.getActiveRole();
this.role = activeRole;
// hide indicator for observer // hide indicator for observer
if (!this.openmct.user.canProvideStatusForRole()) { if (!this.openmct.user.canProvideStatusForRole()) {
this.indicator.text(''); this.indicator.text('');
@ -126,7 +124,12 @@ export default {
return; return;
} }
console.log(activeRole); const activeRole = await this.openmct.user.getActiveRole();
if (!activeRole) {
return;
}
this.role = activeRole;
const status = await this.openmct.user.status.getStatusForRole(activeRole); const status = await this.openmct.user.status.getStatusForRole(activeRole);
if (status !== undefined) { if (status !== undefined) {
this.setStatus({ status }); this.setStatus({ status });