nuVistA/htdocs/App.vue
2023-05-01 20:23:26 -04:00

61 lines
1.8 KiB
Vue

<template>
<div class="container-fluid" style="padding-top: 5rem;">
<Navbar v-model:server="server" :user="user" />
<Throbber :client="client" />
<div class="container">
<Login :secret="secret" v-model:client="client" v-model:server="server" v-model:user="user" />
<router-view v-if="user" :client="client"></router-view>
</div>
</div>
</template>
<script>
import Navbar from './Navbar.vue';
import Throbber from './Throbber.vue';
import Login from './Login.vue';
import RouteSchedule from './RouteSchedule.vue';
import RoutePatientLookup from './RoutePatientLookup.vue';
import RoutePatientDetail from './RoutePatientDetail.vue';
import RoutePatientVisits from './RoutePatientVisits.vue';
import RoutePatientOrders from './RoutePatientOrders.vue';
import RouteScheduleOverview from './RouteScheduleOverview.vue';
import RouteRecall from './RouteRecall.vue';
export default {
components: {
Navbar, Throbber, Login
},
props: {
secret: String
},
data() {
return {
client: null,
server: null,
user: null,
heartbeat: null,
banner: '',
authenticated: false
};
},
watch: {
async client(value, oldvalue) {
if(this.heartbeat) window.clearInterval(this.heartbeat);
else {
[
{ path: '/', component: RouteSchedule },
{ path: '/patient', component: RoutePatientLookup },
{ path: '/patient/:id', component: RoutePatientDetail },
{ path: '/patient/:id/visits', component: RoutePatientVisits },
{ path: '/patient/:id/orders', component: RoutePatientOrders },
{ path: '/overview', component: RouteScheduleOverview },
{ path: '/recall', component: RouteRecall },
].forEach(route => this.$root.$router.addRoute(route));
await this.$root.$router.replace(this.$route);
}
if(value) this.heartbeat = await value.heartbeat();
}
}
};
</script>