Skip to content

Commit 2e69297

Browse files
committed
fix port selection
1 parent c2afd67 commit 2e69297

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tauri-wrapper/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,16 @@ <h2>Existing home folders</h2>
195195
window.__TAURI__.invoke('boot')
196196
.catch(console.error);
197197
}, 300);
198-
checkAndRedirect();
198+
checkAndRedirect((nodePort.value) ? nodePort.value : "8080");
199199
});
200200

201-
let port = (nodePort.value) ? nodePort.value : "8080";
202-
203-
function checkAndRedirect() {
201+
function checkAndRedirect(port) {
204202
fetch(`http://localhost:${port}`, { mode: 'no-cors' })
205203
.then(() => {
206204
window.location.href = `http://localhost:${port}`;
207205
})
208206
.catch(() => {
209-
setTimeout(checkAndRedirect, 1000);
207+
setTimeout(() => checkAndRedirect(port), 1000);
210208
});
211209
}
212210

0 commit comments

Comments
 (0)