Skip to content

Commit

Permalink
chore: Convert session access to optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
flozia committed Dec 5, 2023
1 parent e3d3852 commit 7c024e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ declare global {

export default async function UserBreaches() {
const session = await getServerSession(authOptions);
if (!session || !session.user?.subscriber) {
if (!session?.user?.subscriber) {
return <SignInButton autoSignIn />;
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/(nextjs_migration)/(authenticated)/user/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export type Props = {

const MainLayout = async (props: Props) => {
const session = await getServerSession(authOptions);
if (!session || !session.user?.subscriber) {
if (!session?.user?.subscriber) {
return <SignInButton autoSignIn />;
}

const userId = session?.user?.subscriber?.fxa_uid ?? "";
const userId = session.user.subscriber.fxa_uid ?? "";

if (!userId) {
logger.error("No user ID for telemetry");
Expand Down

0 comments on commit 7c024e2

Please sign in to comment.