Conversation
MichalKalita
left a comment
There was a problem hiding this comment.
I think 8 spaces in JS is a lot.
Better can be spaces, or 1 tab. And setup in editor how wide it should be.
All review commends are only "cosmetic" and should not change how the code works. So I am approving this PR.
It think it's good work for first Svelte usage in real application 🎉
| @@ -0,0 +1,3817 @@ | |||
| var __defProp = Object.defineProperty; | |||
There was a problem hiding this comment.
I am not sure about workflow.
Standard way is not include build into source code in git.
| const update = { ...options }; | ||
| update.headers = { | ||
| ...update.headers, | ||
| "X-Instance-Fingerprint": instanceFingerprint | ||
| }; | ||
| return update; |
There was a problem hiding this comment.
| const update = { ...options }; | |
| update.headers = { | |
| ...update.headers, | |
| "X-Instance-Fingerprint": instanceFingerprint | |
| }; | |
| return update; | |
| return { | |
| ...options, | |
| headers: { | |
| ...options.headers, | |
| "X-Instance-Fingerprint": instanceFingerprint | |
| } | |
| }; |
| fetcher(requestUrl + "/wifi/api/hotspot_not_needed", {method: 'POST'}); | ||
| } | ||
|
|
||
| const instanceFingerprint = document.getElementById("instance-fingerprint").value; |
There was a problem hiding this comment.
This can be unsafe, when JS is loaded before element exists.
It will be better to wrap this into simple function.
| const data = new URLSearchParams() | ||
| for (let field of formData) { | ||
| const [key, value] = field | ||
| data.append(key, value) | ||
| } |
There was a problem hiding this comment.
form data can be used directly as input to URLSearchParams
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams
| const data = await response.json(); | ||
| processConnectionInfo(data); | ||
| } catch (error) { | ||
| console.log(error); |
There was a problem hiding this comment.
use console.error, here and in line 99
| <div class="container p-0" transition:slide> | ||
| <div class="row"> | ||
| <div class="col-lg-4 col"> | ||
| <ConnectForm ap={ {} } {connectionChange}/> |
There was a problem hiding this comment.
Instead of ap={ {} }
You can setup default value in ConnectForm component
export let ap = {};
Or make it working with undefined value
| </div> | ||
| {#each aps as ap (ap.ssid)} | ||
| <!-- svelte-ignore a11y-no-static-element-interactions svelte-ignore a11y-click-events-have-key-events --> | ||
| <div class="row border border-white border-top-0 pt-2 pb-2" on:click|stopPropagation={() => {selectAp(ap);}} transition:slide> |
There was a problem hiding this comment.
| <div class="row border border-white border-top-0 pt-2 pb-2" on:click|stopPropagation={() => {selectAp(ap);}} transition:slide> | |
| <div class="row border border-white border-top-0 pt-2 pb-2" on:click|stopPropagation={() => selectAp(ap)} transition:slide> |
| let potentialRedirectProbe; | ||
| for (const probeResult of receivedProbeResulte) { | ||
| if (probeResult.reachable && !probeResult.sameAsHost) { | ||
| potentialRedirectProbe = probeResult; | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
receivedProbeResulte typo, should be s on end
| let potentialRedirectProbe; | |
| for (const probeResult of receivedProbeResulte) { | |
| if (probeResult.reachable && !probeResult.sameAsHost) { | |
| potentialRedirectProbe = probeResult; | |
| break; | |
| } | |
| } | |
| let potentialRedirectProbe = receivedProbeResulte.find(r => r.reachable && !r.sameAsHost) |
| let newAvailable = []; | ||
| for (const probeResult of receivedProbeResults) { | ||
| if (probeResult.ip && !probeResult.sameAsHost) { | ||
| newAvailable.push(probeResult.ip); | ||
| } | ||
| } | ||
| availableIps = newAvailable; |
There was a problem hiding this comment.
| let newAvailable = []; | |
| for (const probeResult of receivedProbeResults) { | |
| if (probeResult.ip && !probeResult.sameAsHost) { | |
| newAvailable.push(probeResult.ip); | |
| } | |
| } | |
| availableIps = newAvailable; | |
| availableIps = receivedProbeResults | |
| .filter(r => probeResult.ip && !probeResult.sameAsHost) | |
| .map(r => r.ip); |
No description provided.