woj-server/internal/api/user/logout.go

28 lines
637 B
Go
Raw Normal View History

package user
import (
2023-07-14 21:47:11 +08:00
"git.0x7f.app/WOJ/woj-server/internal/e"
2023-07-15 16:19:49 +08:00
"git.0x7f.app/WOJ/woj-server/internal/model"
"github.com/gin-gonic/gin"
)
// Logout
// @Summary logout
// @Description logout
2023-12-18 21:21:15 +08:00
// @Tags user
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Response 200 {object} e.Response "nil"
// @Security Authentication
// @Router /v1/user/logout [post]
func (h *handler) Logout(c *gin.Context) {
claim, exist := c.Get("claim")
if !exist {
e.Pong(c, e.UserUnauthenticated, nil)
return
}
2023-07-15 16:19:49 +08:00
_, status := h.userService.IncrVersion(claim.(*model.Claim).UID)
2022-09-20 14:15:21 +08:00
e.Pong(c, status, nil)
}