Skip to content

Commit 680b3cc

Browse files
committed
Only allow auth'd users to comment
1 parent 07d868a commit 680b3cc

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SUPABASE_URL=
2+
SUPABASE_ANON_KEY=

app/lib/comment-item.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { TrashIcon } from "@heroicons/react/outline";
2-
import { Auth } from "@supabase/ui";
1+
import React from "react";
32
import Link from "next/link";
43
import { useRouter } from "next/router";
5-
import React from "react";
4+
65
import { useMutation } from "urql";
76

7+
import { Auth } from "@supabase/ui";
8+
import { TrashIcon } from "@heroicons/react/outline";
9+
810
import { DocumentType, gql } from "../gql";
911
import { timeAgo } from "./time-ago";
1012

app/pages/item/[postId].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const Item: NextPage = () => {
117117
<FeedItem post={post.node} key={post.cursor} />
118118

119119
<div className="max-w-md">
120-
<PostCommentForm postId={post.node.id} />
120+
{user && <PostCommentForm postId={post.node.id} />}
121121

122122
<div className="mt-10">
123123
{post.node?.comments?.edges.map((edge) => (

0 commit comments

Comments
 (0)