fixed loop error

This commit is contained in:
WeeXnes 2025-02-28 22:01:38 +01:00
parent c56a146def
commit 56fe2afb1a
2 changed files with 11 additions and 5 deletions

View file

@ -220,6 +220,8 @@ const fetchSettings = async () => {
} }
} }
let intervalId: NodeJS.Timeout;
onMounted(async () => { onMounted(async () => {
let isAuthed = await checkAuth(useRouter()) let isAuthed = await checkAuth(useRouter())
if(isAuthed){ if(isAuthed){
@ -231,15 +233,19 @@ onMounted(async () => {
await fetchMemoryInfo() await fetchMemoryInfo()
await fetchNetworkInfo() await fetchNetworkInfo()
if(settings.enable_services) await fetchServiceInfo() if(settings.enable_services) await fetchServiceInfo()
const intervalId = setInterval(fetchCpuTemp, 7000); intervalId = setInterval(fetchCpuTemp, 7000);
onUnmounted(() => {
clearInterval(intervalId);
});
} }
}) })
onBeforeUnmount(()=>{
clearInterval(intervalId);
})
</script> </script>

View file

@ -24,5 +24,5 @@ export const settings = reactive({
"libvirt", "libvirt",
"frp" "frp"
], ],
password_hash: "" password_hash: "$2b$10$cdGQ1EqJxtTFe.E9ifZ.0O2inml3sEcLaWFyK9EdmCelmZ2l2Ez8e"
}); });