introduce graphql
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import strawberry
|
||||
from app.auth.jwt import create_jwt_token, create_refresh_token
|
||||
|
||||
@strawberry.type
|
||||
class AuthResponse:
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str
|
||||
|
||||
@strawberry.type
|
||||
class Mutation:
|
||||
@strawberry.mutation
|
||||
def logout(self) -> str:
|
||||
return "ok"
|
||||
|
||||
# 提示:像 Google OAuth 这种涉及第三方重定向的流程,
|
||||
# 依然保留现有的 RESTful (/login/google 和 /auth/callback) 会更简单。
|
||||
# 登录成功后重定向回前端,前端拿到 token,后续所有数据交互全部走 GraphQL。
|
||||
Reference in New Issue
Block a user