Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
81aaa99
[#99] ✨ add Pagination component
KingNono1030 Nov 28, 2024
80eb871
[#99] ✨ add usePagination hook
KingNono1030 Nov 28, 2024
a54d8ca
[#99] πŸ’„ update chevron-right svg with currentColor attribute
KingNono1030 Nov 28, 2024
35af466
[#99] ♻️ refactor button from using label and icons props to children…
KingNono1030 Nov 28, 2024
3800646
[#99] ♻️ reflect changes in Clickable on module content component
KingNono1030 Nov 28, 2024
aa76d6e
[#99] βœ… add Pagination stories
KingNono1030 Nov 28, 2024
beef83f
[#99] ✨ add extended twMerge due to the issue with merging custom cla…
KingNono1030 Nov 28, 2024
879f6dd
[#99] ♻️ apply extended twMerge in clickable to test if it works
KingNono1030 Nov 28, 2024
480b956
Merge branch 'dev' of https://github.com/DevFDev/frontend into feat/s…
KingNono1030 Nov 28, 2024
99d20a6
[#99] ♻️ separate resuable interface (UsePagination)
KingNono1030 Nov 28, 2024
ef56aca
[#99] ♻️ replace clsx with twMergeEx in Pagination component
KingNono1030 Nov 28, 2024
57bb634
[#99] ♻️ add conditional className handling function in Pagination co…
KingNono1030 Nov 28, 2024
7d1a3e1
[#99] 🚚 rename UsePaginationReturn into PaginationState
KingNono1030 Nov 28, 2024
6de651e
[#134] 🚚 rename api related type locations to types/api/...
KingNono1030 Nov 28, 2024
2dadded
[#134] πŸ”§ update generate:types scripts with type saving path
KingNono1030 Nov 28, 2024
4987eff
[#134] 🚚 reflect location change of type files on import lines
KingNono1030 Nov 28, 2024
fabc065
[#136] πŸ› add return type to functions
KingNono1030 Nov 28, 2024
98ad27b
[#136] πŸ› fix any type usages by exploiting httperror interface from ky
KingNono1030 Nov 28, 2024
1df414e
[#136] πŸ—‘οΈ remove unused lines
KingNono1030 Nov 28, 2024
9efb0b8
[#136] πŸ› solve merge conflicts in pagination stories
KingNono1030 Nov 28, 2024
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
2 changes: 1 addition & 1 deletion src/app/(pages)/protected/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function protectedPage() {
export default function protectedPage(): JSX.Element {
return (
<>
<div>μΈμ¦λ˜μ–΄μ•Όλ§Œ μ ‘κ·Ό κ°€λŠ₯ν•œ νŽ˜μ΄μ§€</div>
Expand Down
7 changes: 3 additions & 4 deletions src/app/(pages)/sign-up/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use client'

import { useRouter } from 'next/navigation'

// import { useRouter } from 'next/navigation'
import { SubmitHandler, useForm } from 'react-hook-form'

import { SignUpRequest } from '@/types/api/auth.types'
import { useSignUpMutation } from 'queries/useSignUp'

export default function SignUpPage(): JSX.Element {
const router = useRouter()
// const router = useRouter()
const {
register,
handleSubmit,
formState: { errors },
// formState: { errors },
} = useForm<SignUpRequest>()
const mutation = useSignUpMutation()

Expand Down
10 changes: 4 additions & 6 deletions src/app/api/auth/refresh/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NextResponse } from 'next/server'

import { backendApi } from '@/services/api'
import { HTTPError } from 'ky'

const BACKEND_BASE_URL = process.env.NEXT_PUBLIC_BACKEND_BASE_URL
import { backendApi } from '@/services/api'

export const POST = async (req: Request): Promise<NextResponse> => {
const { refreshToken } = await req.json()
Expand All @@ -12,10 +12,9 @@ export const POST = async (req: Request): Promise<NextResponse> => {
.post('refresh', { json: { refreshToken } })
.json<{ accessToken: string }>()
return NextResponse.json({ success: true, accessToken })
} catch (error: any) {
} catch (error: unknown) {
console.error('토큰 κ°±μ‹  μ—λŸ¬:', error)

if (error.response) {
if (error instanceof HTTPError) {
const errorData = await error.response.json()
return NextResponse.json(
{
Expand All @@ -25,7 +24,6 @@ export const POST = async (req: Request): Promise<NextResponse> => {
{ status: error.response.status }
)
}

return NextResponse.json(
{ success: false, message: 'Internal server error' },
{ status: 500 }
Expand Down
11 changes: 6 additions & 5 deletions src/app/api/auth/sign-in/route.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { NextResponse } from 'next/server'

import { SignInRequest, SignInResponseResult } from '@/types/api/auth.types'
import { SignInRequest, SignInResponse } from '@/types/api/auth.types'
import { HTTPError } from 'ky'

import { backendApi } from '@/services/api'

export const POST = async (req: Request): Promise<NextResponse> => {
const { email, password } = await req.json()
const { email, password }: SignInRequest = await req.json()

try {
const { accessToken, refreshToken } = await backendApi
.post('v1/auth/sign-in', {
json: { email, password },
})
.json<SignInResponseResult>()
.json<SignInResponse>()

const res = NextResponse.json({ success: true })

Expand All @@ -33,10 +34,10 @@ export const POST = async (req: Request): Promise<NextResponse> => {
})

return res
} catch (error: any) {
} catch (error: unknown) {
console.error('Login failed:', error)

if (error.response) {
if (error instanceof HTTPError) {
const errorData = await error.response.json()
return NextResponse.json(
{ error: errorData.message || 'Login failed' },
Expand Down
6 changes: 4 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const config = {
// 인증이 ν•„μš”ν•œ μ‚¬μ΄νŠΈ
}

export async function middleware(req: NextRequest) {
export async function middleware(
req: NextRequest
): Promise<NextResponse<unknown>> {
console.log('Middleware is running')
console.log('Requested URL:', req.nextUrl.pathname)
console.log('Headers:', req.headers)
Expand Down Expand Up @@ -44,7 +46,7 @@ export async function middleware(req: NextRequest) {
})

return res
} catch (error: any) {
} catch (error: unknown) {
console.error('μ—‘μ„ΈμŠ€ 토큰 κ°±μ‹  μ‹€νŒ¨', error)
return NextResponse.redirect(new URL('/sign-in', req.url))
}
Expand Down