fix: update logic for waiting
This commit is contained in:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user