mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: add auth status checks
This commit is contained in:
18
api/v2/auth_service.go
Normal file
18
api/v2/auth_service.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user