add: logout handling
This commit is contained in:
@@ -43,7 +43,13 @@ func (uc *UserController) CurrentUserHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, user.Safe())
|
||||
}
|
||||
|
||||
func (uc *UserController) LoginUser(c *gin.Context) {
|
||||
func (uc *UserController) LogoutHandler(c *gin.Context) {
|
||||
// just clear the JWT cookie
|
||||
c.SetCookie("jwt", "", -1, "/", "", true, true)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Logged out successfully"})
|
||||
}
|
||||
|
||||
func (uc *UserController) LoginHandler(c *gin.Context) {
|
||||
var input struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
|
||||
Reference in New Issue
Block a user