You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
337 B
18 lines
337 B
package queries
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.aiterp.net/rpdata/api/internal/auth"
|
|
"git.aiterp.net/rpdata/api/models"
|
|
)
|
|
|
|
func (r *resolver) Token(ctx context.Context) (*models.Token, error) {
|
|
token := auth.TokenFromContext(ctx)
|
|
if !token.Authenticated() {
|
|
return nil, errors.New("No (valid) token")
|
|
}
|
|
|
|
return token, nil
|
|
}
|