Skip to content

Commit

Permalink
chore: npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
gohan5858 committed Oct 26, 2024
1 parent 982acad commit 4cf14b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions task_yell/src/components/sign-in-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ function useUserSession() {

useEffect(() => {
const unsubscribe = onAuthStateChanged((authUser) => {
setUser(authUser)
})
setUser(authUser);
});

return () => unsubscribe()
return () => unsubscribe();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
onAuthStateChanged((authUser) => {
if (user === undefined) return
if (user === undefined) return;

// refresh when user changed to ease testing
if (user?.email !== authUser?.email) {
router.refresh()
router.refresh();
}
})
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [user, router.refresh])
}, [user, router.refresh]);

return user;
}
Expand All @@ -55,15 +55,17 @@ export function SignInButton() {
await signInWithPopup(auth, provider);
}, []);
const handleSignOut = useCallback(async () => {
console.log("signing out")
console.log("signing out");
await auth.signOut();
}, []);

return !user ?
(<button type="button" onClick={handleSignIn} >
return !user ? (
<button type="button" onClick={handleSignIn}>
サインイン
</button>) : (<button type="button" onClick={handleSignOut}>
</button>
) : (
<button type="button" onClick={handleSignOut}>
サインアウト
</button>
)
}
);
}
2 changes: 1 addition & 1 deletion task_yell/src/firebase/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export async function signOut() {
} catch (error) {
console.error("Error signing out with Google", error);
}
}
}

0 comments on commit 4cf14b8

Please sign in to comment.