package network

import (
	"floares/lib/http/network"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Disconnect(c *gin.Context) {
	ns := c.Param("ns")
	id := c.Query("id")
	err := network.DisConnect(ns, id)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"error": err.Error(),
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"err": "",
	})
}
func Connect(c *gin.Context) {
	ns := c.Param("ns")
	id := c.Query("id")
	err := network.Connect(ns, id)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"error": err.Error(),
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"err": "",
	})
}
