0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Reactを使ってブログサイトを作る 07 - 個人情報の表示

Last updated at Posted at 2024-12-30

個人情報の表示

image.png

  • Reduxのstore内でユーザー情報を取得する関連ロジックを作成。

image.png

  • Layoutコンポーネント内でactionを実行し、store内のデータを使用してユーザー名をレンダリング。

image.png

ログアウト

  • ポップアップ確認ボックスに確認のコールバックイベントを追加。
  • store/userStore.js内にログアウト用のaction関数を新規作成し、その中でtokenを削除。
  • コールバックイベント内でuserStoreのログアウトactionを呼び出し。
  • ユーザー情報をクリアし、ログインページにリダイレクト。

image.png

image.png

トークンの無効化処理

  • トークンが無効になると、バックエンドから401エラーが返されるため、request.jsで戻り値をチェック。
    image.png
  • image.png
    image.png

インターフェースの統一管理

  • src下にapisフォルダーを作成し、ログインリクエストやユーザー情報の取得、チャンネルリストの取得など、使用するAPIを統一して管理。

image.png

image.png

uploading...0

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?