Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to connect to password-less WiFi network #136

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions ui/src/components/WifiConnect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
filled
hide-bottom-space
:rules="[(val: string) =>
val.length > 7
(val.length === 0 || val.length > 7)
|| $t('components.wifi.connect.invalid_password_length')]"
:label="$t('general.password')"
type="password"
:disable="isWifiStatus"
:disable="isWifiStatus || wifiConnection?.value?.conn_type === 'NONE'"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't working, any idea why @Maggie0002?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may not need the .value component, that's usually only when referring to ref in typescript rather than Vue.

/>
</div>
<div class="q-mt-md text-center">
Expand Down Expand Up @@ -147,6 +147,12 @@ interface WifiStatusRes {
wifi: boolean
}

interface WifiParams {
ssid: string
conn_type: string
password?: string
}

export default defineComponent({
name: 'WifiConnect',
components: {
Expand Down Expand Up @@ -197,15 +203,18 @@ export default defineComponent({

async function connect() {
isSubmitting.value = true
const params:WifiParams = {
ssid: wifiConnection?.value?.ssid,
conn_type: wifiConnection?.value?.conn_type
}
if (wifiConnection?.value?.conn_type !== 'NONE') {
params.password = password?.value
}
try {
await expressApi.post('/v1/wifi', {
type: 'POST',
path: 'v1/connect',
params: {
ssid: wifiConnection?.value?.ssid,
conn_type: wifiConnection?.value?.conn_type,
password: password.value
}
params
})

isWifiStatus.value = true
Expand Down