Compare commits
3 Commits
adf6c1e9dd
...
4be8726efb
Author | SHA1 | Date | |
---|---|---|---|
4be8726efb | |||
baec55b8a9 | |||
c5a32c68a5 |
@ -1,5 +1,12 @@
|
|||||||
package domain
|
package domain
|
||||||
|
|
||||||
|
type LoginResponse struct {
|
||||||
|
Success bool `json:"success"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
RefreshToken string `json:"refreshToken"`
|
||||||
|
}
|
||||||
|
|
||||||
type ErrorResponse struct {
|
type ErrorResponse struct {
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.jamestombleson.com/jtom38/go-cook/api/repositories"
|
|
||||||
"git.jamestombleson.com/jtom38/go-cook/api/domain"
|
"git.jamestombleson.com/jtom38/go-cook/api/domain"
|
||||||
|
"git.jamestombleson.com/jtom38/go-cook/api/repositories"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
@ -89,7 +89,12 @@ func (h *Handler) AuthLogin(c echo.Context) error {
|
|||||||
return h.InternalServerErrorResponse(c, err.Error())
|
return h.InternalServerErrorResponse(c, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, token)
|
return c.JSON(http.StatusOK, domain.LoginResponse{
|
||||||
|
Success: true,
|
||||||
|
Token: token,
|
||||||
|
Type: "Bearer",
|
||||||
|
RefreshToken: "",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) validateAdminToken(c echo.Context, password string) error {
|
func (h *Handler) validateAdminToken(c echo.Context, password string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user