-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 데이터 타입 수정 * feat: 제출한 퀴즈 데이터 페칭 로직 구현 * feat: 유저 페이지 구현 * chore: husky 명령어 수정 * feat: queryOptions로 변경
- Loading branch information
Showing
5 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run lint-staged | ||
case `uname` in | ||
*CYGWIN*|*MINGW*|*MSYS*) | ||
npm.cmd run lint-staged | ||
;; | ||
*) | ||
npm run lint-staged | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { QuizCard } from '@/components/quiz/quiz-card'; | ||
import quizOptions from '@/services/quiz/options'; | ||
import { createClient } from '@/utils/supabase/server'; | ||
import { | ||
HydrationBoundary, | ||
QueryClient, | ||
dehydrate, | ||
} from '@tanstack/react-query'; | ||
import { cookies } from 'next/headers'; | ||
|
||
export default async function Page() { | ||
const cookieStore = cookies(); | ||
const supabase = createClient(cookieStore); | ||
const { | ||
data: { user }, | ||
} = await supabase.auth.getUser(); | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
const submittedQuiz = await queryClient.fetchQuery( | ||
quizOptions.submitted(user?.id ?? '') | ||
); | ||
|
||
return ( | ||
<> | ||
<h1 className="text-right text-3xl font-bold"> | ||
{user?.user_metadata.user_name} | ||
</h1> | ||
<h2 className="text-xl font-bold">풀었던 퀴즈</h2> | ||
<HydrationBoundary state={dehydrate(queryClient)}> | ||
{submittedQuiz && submittedQuiz.length ? ( | ||
<ul className="flex flex-col gap-6"> | ||
{submittedQuiz.map( | ||
({ quiz_id, success, quizzes }) => | ||
quizzes && ( | ||
<QuizCard | ||
key={quiz_id} | ||
status={success ? 'correct' : 'wrong'} | ||
difficulty={quizzes.difficulty} | ||
title={quizzes.title} | ||
summary={quizzes.summary} | ||
/> | ||
) | ||
)} | ||
</ul> | ||
) : ( | ||
<p>제출한 퀴즈가 없습니다.</p> | ||
)} | ||
</HydrationBoundary> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters