MCPcopy Index your code
hub / github.com/apache/answer / UserLogout

Method UserLogout

internal/controller/user_controller.go:240–251  ·  view source on GitHub ↗

UserLogout user logout @Summary user logout @Description user logout @Security ApiKeyAuth @Tags User @Accept json @Produce json @Success 200 {object} handler.RespBody @Router /answer/api/v1/user/logout [get]

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

238// @Success 200 {object} handler.RespBody
239// @Router /answer/api/v1/user/logout [get]
240func (uc *UserController) UserLogout(ctx *gin.Context) {
241 accessToken := middleware.ExtractToken(ctx)
242 if len(accessToken) == 0 {
243 handler.HandleResponse(ctx, nil, nil)
244 return
245 }
246 _ = uc.authService.RemoveUserCacheInfo(ctx, accessToken)
247 _ = uc.authService.RemoveAdminUserCacheInfo(ctx, accessToken)
248 visitToken, _ := ctx.Cookie(constant.UserVisitCookiesCacheKey)
249 _ = uc.authService.RemoveUserVisitCacheInfo(ctx, visitToken)
250 handler.HandleResponse(ctx, nil, nil)
251}
252
253// UserRegisterByEmail godoc
254// @Summary UserRegisterByEmail

Callers

nothing calls this directly

Calls 5

ExtractTokenFunction · 0.92
HandleResponseFunction · 0.92
RemoveUserCacheInfoMethod · 0.65

Tested by

no test coverage detected