Refactored disconnect watcher

This commit is contained in:
2022-09-27 21:39:27 -04:00
parent aa3a3b06a7
commit 93994d5dd7
2 changed files with 4 additions and 6 deletions

View File

@@ -9,8 +9,6 @@
</template>
<script>
import { watchEffect } from 'vue';
import Navbar from './Navbar.vue';
import Login from './Login.vue';
import RouteSchedule from './RouteSchedule.vue';
@@ -47,10 +45,7 @@
].forEach(route => this.$root.$router.addRoute(route));
await this.$root.$router.replace(this.$route);
}
if(value) {
this.heartbeat = await value.heartbeat();
var stop = watchEffect(() => { if(!value.connected.value) { stop(); this.client = this.server = this.user = null; } });
}
if(value) this.heartbeat = await value.heartbeat();
}
}
};