Skip to content

feat: login test #10

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions src/lib/solution-pass/components/SolutionSubmitForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import useColor from "@/lib/@hooks/useColor";
import {
Avatar,
Button,
Center,
Flex,
Expand All @@ -19,7 +18,6 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import "@uiw/react-textarea-code-editor/dist.css";
import { signIn, signOut, useSession } from "next-auth/react";
import dynamic from "next/dynamic";
import Link from "next/link";
import { useRouter } from "next/router";
Expand All @@ -41,19 +39,18 @@ export default function SolutionSubmitForm() {
setCode
} = useSearch();
const { createIssueMutation } = useIssue();
const { data: session } = useSession();
const router = useRouter();

const handelSubmit = () => {
if (session?.user?.name === undefined) return;
// if (session?.user?.name === undefined) return;

createIssueMutation.mutate(
{
title: `${selectedProb?.title} 정답 | ${session.user?.name}`,
title: `${selectedProb?.title} 정답 `,
code,
probId: selectedProb?.id ?? "",
author: session.user?.name ?? "",
assignees: [session.user?.name ?? "", "codeisneverodd"],
author: "codeisneverodd",
assignees: ["codeisneverodd"],
lang
},
{
Expand All @@ -64,10 +61,6 @@ export default function SolutionSubmitForm() {
);
};

const handleSignOut = () => {
signOut();
};

if (!selectedProb) {
return (
<Center w="full" h="120px">
Expand Down Expand Up @@ -110,19 +103,9 @@ export default function SolutionSubmitForm() {
align="center"
justify={{ base: "start", md: "end" }}
>
{session?.user ? (
{/* {session?.user ? (
<>
<Avatar src={session.user.image ?? ""} />
<Text fontWeight="bold">{session.user.name}</Text>
<Button onClick={handleSignOut}>로그아웃</Button>
<Button
isDisabled={code === ""}
isLoading={createIssueMutation.isLoading}
colorScheme="blue"
onClick={handelSubmit}
>
제출
</Button>

</>
) : (
<>
Expand All @@ -135,7 +118,18 @@ export default function SolutionSubmitForm() {
</Button>
<Button isDisabled>로그인 후 제출해주세요</Button>
</>
)}
)} */}
{/* <Avatar src={session.user.image ?? ""} />
<Text fontWeight="bold">{session.user.name}</Text>
<Button onClick={handleSignOut}>로그아웃</Button> */}
<Button
isDisabled={code === ""}
isLoading={createIssueMutation.isLoading}
colorScheme="blue"
onClick={handelSubmit}
>
제출
</Button>
</Flex>
</Flex>

Expand Down