This course is no longer maintained and may be out-of-date. While it remains available for reference, its content may not reflect the latest updates, best practices, or supported features.
todoの取得 - query
最初に作成するgraphql queryでは、パーソナルtodoを取得します。ログインしたユーザーのデータベースからtodoデータを読み込む必要があります。必要なデータを取得するためのgraphql queryを定義します。
query getMyTodos {todos(where: { is_public: { _eq: false} }, order_by: { created_at: desc }) {idtitlecreated_atis_completed}}
アプリケーションデータベースに対してGraphiQLを使ってこのqueryを 試して 、どのような応答が得られるかを確認します。
注 :queryして結果を取得する前に、 Authorization: Bearer <token>
ヘッダーを渡す必要があります。Auto0経由でログインした後、トークンはUIにauto-fillされます。
このqueryは、Reactアプリで実際に使用するgraphql queryなので、期待通りに動作するか検証します。
このgraphql queryをReactアプリに組み込みましょう。
Did you find this page helpful?
Start with GraphQL on Hasura for Free
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs

