memos/api/v2/auth_service.go

19 lines
386 B
Go
Raw Normal View History

2023-11-30 20:58:36 +08:00
package v2
import (
"context"
apiv2pb "github.com/usememos/memos/proto/gen/api/v2"
)
func (s *APIV2Service) GetAuthStatus(ctx context.Context, _ *apiv2pb.GetAuthStatusRequest) (*apiv2pb.GetAuthStatusResponse, error) {
ok := true
user, err := getCurrentUser(ctx, s.Store)
if err != nil || user == nil {
ok = false
}
return &apiv2pb.GetAuthStatusResponse{
Ok: ok,
}, nil
}