MCPcopy Create free account
hub / github.com/daodst/chat / Logout

Function Logout

clientapi/routing/logout.go:26–43  ·  view source on GitHub ↗

Logout handles POST /logout

(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
)

Source from the content-addressed store, hash-verified

24
25// Logout handles POST /logout
26func Logout(
27 req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
28) util.JSONResponse {
29 var performRes api.PerformDeviceDeletionResponse
30 err := userAPI.PerformDeviceDeletion(req.Context(), &api.PerformDeviceDeletionRequest{
31 UserID: device.UserID,
32 DeviceIDs: []string{device.ID},
33 }, &performRes)
34 if err != nil {
35 util.GetLogger(req.Context()).WithError(err).Error("PerformDeviceDeletion failed")
36 return jsonerror.InternalServerError()
37 }
38
39 return util.JSONResponse{
40 Code: http.StatusOK,
41 JSON: struct{}{},
42 }
43}
44
45// LogoutAll handles POST /logout/all
46func LogoutAll(

Callers 1

SetupFunction · 0.85

Calls 3

ContextMethod · 0.80
PerformDeviceDeletionMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected