Change Delete Parameter Name

This commit is contained in:
Samuel Lorch 2023-04-01 01:09:01 +02:00
parent 61ae805305
commit 9568adbd8e
2 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ async function apply(){
} }
async function deleteInterface(){ async function deleteInterface(){
let res = await apiCall("Network.DeleteInterface", {Interface: displayData[selection[0]].name}); let res = await apiCall("Network.DeleteInterface", {name: displayData[selection[0]].name});
if (res.Error === null) { if (res.Error === null) {
console.debug("deleted interface"); console.debug("deleted interface");
} else { } else {

View file

@ -19,16 +19,16 @@ func (f *Network) GetInterfaces(ctx context.Context, params struct{}) (GetInterf
} }
type DeleteInterfaceParameters struct { type DeleteInterfaceParameters struct {
Interface string Name string
} }
func (f *Network) DeleteInterface(ctx context.Context, params DeleteInterfaceParameters) (struct{}, error) { func (f *Network) DeleteInterface(ctx context.Context, params DeleteInterfaceParameters) (struct{}, error) {
_, ok := f.Conf.Network.Interfaces[params.Interface] _, ok := f.Conf.Network.Interfaces[params.Name]
if !ok { if !ok {
return struct{}{}, fmt.Errorf("Interface does not Exist") return struct{}{}, fmt.Errorf("Interface does not Exist")
} }
delete(f.Conf.Network.Interfaces, params.Interface) delete(f.Conf.Network.Interfaces, params.Name)
return struct{}{}, nil return struct{}{}, nil
} }