Skip to content

メモアプリにログインボタンを追加 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 6, 2025
Merged

Conversation

karlley
Copy link
Owner

@karlley karlley commented Mar 31, 2025

やったこと

メモアプリにログインボタンに追加

できるようになること

  • ログイン状態に応じて以下の機能のon/offを切り替える
    • メモ作成
    • メモ更新
    • メモ削除

動作確認

未ログイン状態

unlogin

ログイン状態

login

prettier、eslint

prettier_eslint

その他

  • ESLint、Prettierでのフォーマット確認済み

@karlley
Copy link
Owner Author

karlley commented Apr 1, 2025

useLogin、LoginProviderの2つをexportしているファイルをsrc/hooks/useLogin.js と定義しましたがファイル名と配置したディレクトリに自信が無いです。
適切で無い場合は命名とディレクトリについてアドバイスをいただきたいです。

return storedIsLoggedIn || false;
});
const login = () => {
setIsLoggedIn((prev) => !prev);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not important) この挙動なら関数名は toggleLogin などのほうが妥当かと思いました。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggleLogin に変更しました。

login: () => {},
});

export const LoginProvider = ({ children }) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

永続化しているのはいいですね!
このコンポーネントの全体の機能は LoginProvider なので、ファイル名も LoginProvider.js の方が妥当かもと思いました。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ファイル名をLoginProvider.js に変更しました。

@karlley karlley merged commit b97a65a into main Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants