Skip to content
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

author.username returns null #30

Open
1moein opened this issue Jun 15, 2023 · 1 comment
Open

author.username returns null #30

1moein opened this issue Jun 15, 2023 · 1 comment

Comments

@1moein
Copy link

1moein commented Jun 15, 2023

When @t3dotgg added the username to the posts, I followed along but I would get null values for usernames. As a replacement, I used a portion of the author.id string and kept the author.username in there to fix later.
I can no longer sweep this issue under the rug and need to fix it. Any suggestions would be appreciated. I am using github login, btw.
Here's how the username looks for me right now and the code is shown below.
image

const PostView = (props: PostWithUser) => {
  const { post, author } = props;
  //const displayname = `@user..${author.id.slice(-5)}.${author.username}`;
  return (
    <div key={post.id} className="flex border-b border-slate-400 p-8">
      <Image
        src={author.profileImageUrl}
        className="h-14 w-14 rounded-full"
        //alt={`${displayname}'s profile picture`}
        alt="profile picture"
        width={56}
        height={56}
      />
      <div className="flex flex-col">
        <div className="flex gap-1 font-bold text-slate-300">
          <span>{`@user..${author.id.slice(-5)}.${author.username}`}</span>
          <span className="font-thin">{${dayjs(
            post.createdAt
          ).fromNow()}`}</span>
        </div>
        <span className="text-2xl">{post.content}</span>
      </div>
    </div>
  );
};

A bit more details:
image

@1moein
Copy link
Author

1moein commented Jun 16, 2023

Update: turns out github username is actually pulled in and shown. The username that shows as null is a Gmail account since I had enabled both github and Google logins. I just need to assign a username for those using Google to log in.

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

No branches or pull requests

1 participant