fix: update logic for waiting

This commit is contained in:
2025-07-22 14:02:30 +02:00
parent 8f5032e531
commit c67b6dfb6a
3 changed files with 31 additions and 13 deletions

View File

@ -30,13 +30,13 @@ const checkStatus = async () => {
try {
const res = await $fetch(`${window.location.origin}/api/status?name=${name}`);
status.value = res.status;
if (interval.value) {
clearInterval(interval.value);
}
if (res.status === 'ready') {
ip.value = res.ip;
clearInterval(interval.value);
loading.value = false;
// Redirect or show login link
window.location.href= redirect ?? `http://${res.ip}`;
window.location.href= 'http://'+ window.location.host;
}
} catch (error) {
loading.value = false;
@ -44,8 +44,8 @@ const checkStatus = async () => {
errorMessage.value = error?.data?.message || 'Internal server error!';
clearInterval(interval.value);
setTimeout( () => {
router.replace(`/?auth=ok&redirect=${redirect}`);
}, 3000);
router.replace(`/app/?auth=ok&redirect=${redirect}`);
}, 5000);
}
};
@ -56,7 +56,9 @@ onMounted(() => {
});
onUnmounted(() => {
clearInterval(interval.value);
if (interval.value) {
clearInterval(interval.value);
}
});
</script>
<style scoped>