RoleChannelProvider to RoleChannel

This commit is contained in:
Michael Rogers 2023-07-06 15:15:33 -05:00
parent aba026ffd2
commit 06f71412a6

View File

@ -30,7 +30,7 @@
</template> </template>
<script> <script>
import RoleChannelProvider from '../../../api/user/RoleChannel'; import RoleChannel from '../../../api/user/RoleChannel';
export default { export default {
inject: ['openmct'], inject: ['openmct'],
data() { data() {
@ -38,20 +38,20 @@ export default {
userName: undefined, userName: undefined,
role: undefined, role: undefined,
loggedIn: false, loggedIn: false,
roleChannelProvider: undefined, roleChannel: undefined,
inputRoleSelection: undefined inputRoleSelection: undefined
}; };
}, },
async mounted() { async mounted() {
this.getUserInfo(); this.getUserInfo();
this.roleChannelProvider = new RoleChannelProvider(this.openmct); this.roleChannel = new RoleChannel(this.openmct);
this.roleChannelProvider.createRoleChannel(); this.roleChannel.createRoleChannel();
this.roleChannelProvider.subscribeToRole(this.setRoleSelection); this.roleChannel.subscribeToRole(this.setRoleSelection);
await this.fetchOrPromptForRole(); await this.fetchOrPromptForRole();
}, },
beforeDestroy() { beforeDestroy() {
this.roleChannelProvider.unsubscribeToRole(); this.roleChannel.unsubscribeToRole();
}, },
methods: { methods: {
async getUserInfo() { async getUserInfo() {
@ -106,7 +106,7 @@ export default {
this.setRoleSelection(role); this.setRoleSelection(role);
this.openmct.user.setActiveRole(role); this.openmct.user.setActiveRole(role);
// update other tabs through broadcast channel // update other tabs through broadcast channel
this.roleChannelProvider.broadcastNewRole(role); this.roleChannel.broadcastNewRole(role);
} }
} }
}; };