Skip to content

Commit

Permalink
frontend: stores: helper: Add ping Action
Browse files Browse the repository at this point in the history
* Add ping action to allow to fetch interface internet access
  individually given some host
  • Loading branch information
JoaoMario109 authored and patrickelectric committed Feb 5, 2025
1 parent e845497 commit d97f053
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/frontend/src/store/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ class PingStore extends VuexModule {
this.updateFoundServices([])
})
}

@Action
async ping(options: {host: string, iface?: string}): Promise<boolean | undefined> {
return back_axios({
method: 'get',
url: `${this.API_URL}/ping`,
params: { host: options.host, interface_addr: options.iface },
timeout: 15000,
})
.then((response) => response.data as boolean)
.catch(() => undefined)
}
}

export { PingStore }
Expand Down

0 comments on commit d97f053

Please sign in to comment.