nuVistA/htdocs/App.vue

57 lines
1.6 KiB
Vue
Raw Normal View History

2022-09-22 07:10:08 -04:00
<template>
<div class="container-fluid">
2022-09-26 17:38:27 -04:00
<Navbar v-model:server="server" :user="user" />
2022-09-22 07:10:08 -04:00
<div class="container">
2022-09-26 17:38:27 -04:00
<Login :secret="secret" v-model:client="client" v-model:server="server" v-model:user="user" />
2022-09-22 07:10:08 -04:00
<router-view v-if="user"></router-view>
</div>
</div>
</template>
<script>
import Navbar from './Navbar.vue';
import Login from './Login.vue';
import RouteSchedule from './RouteSchedule.vue';
import RoutePatientLookup from './RoutePatientLookup.vue';
import RoutePatientDetail from './RoutePatientDetail.vue';
2022-09-23 23:59:55 -04:00
import RouteRecall from './RouteRecall.vue';
2022-09-22 07:10:08 -04:00
export default {
components: {
Navbar, Login
},
props: {
secret: String
},
data() {
return {
client: null,
2022-09-26 17:38:27 -04:00
server: null,
2022-09-22 07:10:08 -04:00
user: null,
heartbeat: null,
banner: '',
authenticated: false
};
},
computed: {
store: () => store
},
watch: {
2022-09-26 17:38:27 -04:00
async client(value, oldvalue) {
2022-09-22 07:10:08 -04:00
if(this.heartbeat) window.clearInterval(this.heartbeat);
else {
[
{ path: '/', component: RouteSchedule, props: { client: this.client } },
{ path: '/patient', component: RoutePatientLookup, props: { client: this.client } },
{ path: '/patient/:id', component: RoutePatientDetail, props: { client: this.client } },
2022-09-23 23:59:55 -04:00
{ path: '/recall', component: RouteRecall, props: { client: this.client } },
2022-09-22 07:10:08 -04:00
].forEach(route => this.$root.$router.addRoute(route));
await this.$root.$router.replace(this.$route);
}
2022-09-26 17:38:27 -04:00
if(value) this.heartbeat = await value.heartbeat();
if(oldvalue) this.$router.go(); // refresh if changed
2022-09-22 07:10:08 -04:00
}
}
};
</script>