Skip to content

Commit 3dbbdeb

Browse files
committed
fix(frontend): Make localhost acceptable in IpForm
1 parent 1d00b12 commit 3dbbdeb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

front-end/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ const IpForm = () => {
1414
async function checkURL(ipAddress, port) {
1515
try {
1616
setCheckingURL(true);
17-
const isIPv4 = /^(\d{1,3}\.){3}\d{1,3}$/.test(ipAddress);
17+
const isIPv4 = ipAddress !== "localhost" ? /^(\d{1,3}\.){3}\d{1,3}$/.test(ipAddress) : "localhost";
18+
19+
// console.log(`http://${isIPv4 ? ipAddress : `[${ipAddress}]`}:${port}/ping`);
1820
const response = await fetch(`http://${isIPv4 ? ipAddress : `[${ipAddress}]`}:${port}/ping`);
1921
setCheckingURL(false);
2022
if (response.ok) {

0 commit comments

Comments
 (0)