Fixed comments for create new device where device not found while saving device_info

This commit is contained in:
Nedim
2023-09-15 07:41:39 +02:00
parent faea7f213b
commit aefa8d927b
3 changed files with 35 additions and 17 deletions

View File

@@ -1,6 +1,9 @@
package controllers
import (
"log"
"net/http"
"gitlab.com/pactual1/backend/middlewares"
"gitlab.com/pactual1/backend/shared"
@@ -11,7 +14,7 @@ import (
type AuthController struct{}
func (this AuthController)HandleLogin(c *gin.Context) {
func (AuthController)HandleLogin(c *gin.Context) {
userId:="123"
username:="Beast"
roles:= []string{shared.RoleAdmin, shared.RoleProUser}
@@ -21,6 +24,8 @@ func (this AuthController)HandleLogin(c *gin.Context) {
//issue token
token, err := middlewares.GenerateToken([]byte(middlewares.SigningKey), userId,username, roles)
if err != nil {
log.Printf("Unable to generate token %v", err)
c.JSON(http.StatusInternalServerError, err)
}
c.JSON(200, token)