Skip to content

Commit

Permalink
remove fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
t3dotgg committed Mar 24, 2023
1 parent 577f7e7 commit 19ed3ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/api/routers/posts.ts
Expand Up @@ -25,7 +25,7 @@ const addUserDataToPosts = async (posts: Post[]) => {
return posts.map((post) => {
const author = users.find((user) => user.id === post.authorId);

if (!author) {
if (!author || !author.username) {
console.error("AUTHOR NOT FOUND", post);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
Expand All @@ -37,7 +37,7 @@ const addUserDataToPosts = async (posts: Post[]) => {
post,
author: {
...author,
username: author.username ?? "(no username)",
username: author.username,
},
};
});
Expand Down

1 comment on commit 19ed3ff

@vercel
Copy link

@vercel vercel bot commented on 19ed3ff Mar 24, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.