woj-server/internal/api/user/logout.go
Paul Pan 26a81652b3 feat: another big update
1. add consumer
2. add createVersion
3. add upload
4. fix runner
5. add rejudge

Co-authored-by: cxy004 <cxy004@qq.com>
Co-authored-by: wzt <w.zhongtao@qq.com>
2022-10-23 17:29:35 +08:00

27 lines
622 B
Go

package user
import (
"github.com/WHUPRJ/woj-server/internal/e"
"github.com/WHUPRJ/woj-server/internal/global"
"github.com/gin-gonic/gin"
)
// Logout
// @Summary logout
// @Description logout
// @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
}
_, status := h.userService.IncrVersion(claim.(*global.Claim).UID)
e.Pong(c, status, nil)
}