mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
wifi delete
This commit is contained in:
committed by
Aiden McClelland
parent
77d34c2a64
commit
debefdbc5f
@@ -49,7 +49,7 @@
|
||||
<ion-icon slot="start" name="add" size="large"></ion-icon>
|
||||
<ion-label>Add new network</ion-label>
|
||||
</ion-item>
|
||||
<ion-item button detail="false" *ngFor="let ssid of wifi.ssids" (click)="presentAction(ssid)">
|
||||
<ion-item button detail="false" *ngFor="let ssid of wifi.ssids; let i = index;" (click)="presentAction(ssid, i)">
|
||||
<div *ngIf="ssid !== wifi.connected" slot="start" style="padding-right: 32px;"></div>
|
||||
<ion-icon *ngIf="ssid === wifi.connected" slot="start" size="large" name="checkmark" color="success"></ion-icon>
|
||||
<ion-label>{{ ssid }}</ion-label>
|
||||
|
||||
@@ -104,13 +104,13 @@ export class WifiPage {
|
||||
await modal.present()
|
||||
}
|
||||
|
||||
async presentAction (ssid: string) {
|
||||
async presentAction (ssid: string, i: number) {
|
||||
const buttons: ActionSheetButton[] = [
|
||||
{
|
||||
text: 'Forget',
|
||||
icon: 'trash',
|
||||
handler: () => {
|
||||
this.delete(ssid)
|
||||
this.delete(ssid, i)
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -258,7 +258,7 @@ export class WifiPage {
|
||||
}
|
||||
}
|
||||
|
||||
private async delete (ssid: string): Promise<void> {
|
||||
private async delete (ssid: string, i: number): Promise<void> {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
message: 'Deleting...',
|
||||
@@ -268,6 +268,9 @@ export class WifiPage {
|
||||
|
||||
try {
|
||||
await this.api.deleteWifi({ ssid })
|
||||
this.wifi.ssids = this.wifi.ssids.filter((w, index) => index !== i)
|
||||
|
||||
console.log(this.wifi.ssids)
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user