Skip to content

Commit

Permalink
Merge pull request #205 from Meetfolio-Project-CodeZ-Team/develop
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
Minkyu0424 authored May 26, 2024
2 parents ea5c91f + 14ff37f commit eb2286e
Show file tree
Hide file tree
Showing 97 changed files with 232 additions and 538 deletions.
39 changes: 39 additions & 0 deletions src/app/(route)/coverletter/feedback/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use client'

import Header from '@/app/components/layout/Header'
import { useEffect, useState } from 'react'
import { useRecoilState } from 'recoil'
import { covletNum } from '../../../recoil/coverletter'

import Footer from '@/app/components/layout/Footer'

import FeedSatisfaction from '@/app/components/coverletter/FeedSatisfaction'

export default function CovletFeedbackPage() {
const [covletNumber, setCovletNumber] = useRecoilState(covletNum)

const [userInfo, setUser] = useState<memberInfo | null>(null)

useEffect(() => {
const fetchData = async () => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_NEXT_SERVER}/api/main/user`,
)
const resData = await response.json()
setUser(resData.result)
console.log(resData)
}

fetchData()
}, [covletNumber])

return (
<section className="flex flex-col items-center min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="w-[1440px] mb-[300px]">
<FeedSatisfaction feedback_id={0} />
</div>
<Footer />
</section>
)
}
2 changes: 1 addition & 1 deletion src/app/(route)/coverletter/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { covletData, covletNum } from '../../recoil/coverletter'
export default function CovletMainPage() {
const [covletNumber, setCovletNumber] = useRecoilState(covletNum)
const [coverletterData, setCoverLetterData] = useRecoilState(covletData)

const [userInfo, setUser] = useState<memberInfo | null>(null)

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion src/app/(route)/edit-coverletter/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const EditCoverLetterPage = ({ params }: { params: { id: string } }) => {
const [coverletterData, setCoverLetterData] = useRecoilState(covletData)
const [userInfo, setUser] = useState<memberInfo | null>(null)


const router = useRouter()

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion src/app/(route)/edit-experience/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const EditExperiencePage = ({ params }: { params: { id: string } }) => {
const [userInfo, setUser] = useState<memberInfo | null>(null)

const [experienceData, setExperienceData] = useRecoilState(expData)


useEffect(() => {
const fetchData = async () => {
Expand Down
14 changes: 7 additions & 7 deletions src/app/(route)/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export default function ErrorPage({
}) {
const [userInfo, setUser] = useState<memberInfo | null>(null)
const router = useRouter()
// useEffect(() => {
// document.cookie =
// 'accessToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
// document.cookie =
// 'refreshToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
// router.push('/login')
// }, [error])
useEffect(() => {
document.cookie =
'accessToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
document.cookie =
'refreshToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
router.push('/login')
}, [error])

useEffect(() => {
const fetchData = async () => {
Expand Down
1 change: 0 additions & 1 deletion src/app/(route)/experience/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function ExperiencePage() {
const [experienceNumber, setExperienceNumber] = useRecoilState(expNum)
const [experienceData, setExperienceData] = useRecoilState(expData)
const [userInfo, setUser] = useState<memberInfo | null>(null)


useEffect(() => {
const fetchData = async () => {
Expand Down
9 changes: 5 additions & 4 deletions src/app/(route)/mypage/boardDetail/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import BoardCardDetail from '@/app/components/mypage/BoardCardDetail'
import UserNavContainer from '@/app/components/mypage/UserNavContainer'
import { useEffect, useState } from 'react'



export default function BoardDetailPage({
params,
}: {
params: { id: string }
}) {
const [userInfo, setUser] = useState<memberInfo | null>(null)


useEffect(() => {
const fetchData = async () => {
Expand All @@ -30,7 +27,11 @@ export default function BoardDetailPage({
<section className="flex flex-col min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="flex w-[full] h-[980px] mb-[200px]">
<UserNavContainer selected={'board'} nickname={userInfo?.memberName} profile={userInfo?.profile}/>
<UserNavContainer
selected={'board'}
nickname={userInfo?.memberName}
profile={userInfo?.profile}
/>
<div className="flex-grow">
<BoardCardDetail nickname={userInfo?.memberName} />
</div>
Expand Down
59 changes: 56 additions & 3 deletions src/app/(route)/mypage/myCovletDetail/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import UserNavContainer from '@/app/components/mypage/UserNavContainer'
import {
analysisData,
covletData,
covletNum,
feedbackData,
tidState,
} from '@/app/recoil/coverletter'
import { useRouter, useSearchParams } from 'next/navigation'
import { useEffect, useState } from 'react'
Expand All @@ -22,6 +22,61 @@ const MyCovletDetailPage = ({ params }: { params: { id: string } }) => {
const [analySisData, setAnalySisData] = useRecoilState(analysisData)
const isGuest = paramsData.get('isGuest')

const [tid, setTid] = useRecoilState(tidState)
const router = useRouter()
const paramsInfo = useSearchParams()
const pg_token = paramsInfo.get('pg_token')

useEffect(() => {
if (pg_token) {
const getTid = async () => {
try {
const response = await fetch('/api/kakaopay/tid/approve')
const data = await response.json()
setTid(data.result.tid)

const SECRET_KEY = 'DEV0B0F086576B04B715B7404AA618D4C0B985A'
const requestData = {
cid: 'TC0ONETIME',
tid: data.result.tid,
partner_order_id: 'meetfolio',
partner_user_id: 'meetfolio',
pg_token: pg_token,
}
const requestConfig = {
method: 'POST',
headers: {
Authorization: `SECRET_KEY ${SECRET_KEY}`,
'Content-type': 'application/json',
},
body: JSON.stringify(requestData),
}

const res = await fetch(
`${process.env.NEXT_PUBLIC_NEXT_SERVER}/api/kakaopay/approve`,
requestConfig,
)
const resdata = await res.json()

const req = {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify({ tid: data.result.tid }),
}

const sendApprove = await fetch(
`${process.env.NEXT_PUBLIC_NEXT_SERVER}/api/kakaopay/payments/approve`,
req,
)
const approveRes = await sendApprove.json()
} catch (error) {}
}
getTid()
}
}, [pg_token])

useEffect(() => {
const fetchData = async () => {
const response = await fetch(
Expand All @@ -34,7 +89,6 @@ const MyCovletDetailPage = ({ params }: { params: { id: string } }) => {
}, [])

useEffect(() => {

if (params.id && typeof params.id === 'string') {
fetch(`/api/mypage/myCovletDetail?coverLetterId=${Number(params.id)}`)
.then((response) => response.json())
Expand All @@ -50,7 +104,6 @@ const MyCovletDetailPage = ({ params }: { params: { id: string } }) => {
if (data && data.result && data.result.analysisInfo) {
setAnalySisData(data.result.analysisInfo)
}

})
.catch((error) => {
console.error('Failed to fetch cover letter details:', error)
Expand Down
6 changes: 5 additions & 1 deletion src/app/(route)/mypage/myboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export default function MyBoardPage() {
<section className="flex flex-col min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="flex w-full h-full mb-[200px]">
<UserNavContainer selected={'board'} nickname={userInfo?.memberName} profile={userInfo?.profile}/>
<UserNavContainer
selected={'board'}
nickname={userInfo?.memberName}
profile={userInfo?.profile}
/>
<div className="flex-grow ">
{boardNumber === 0 && <MyBoard />}
{boardNumber === 1 && <MyLike />}
Expand Down
6 changes: 5 additions & 1 deletion src/app/(route)/mypage/mypoint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export default function MyPointPage() {
<section className="flex flex-col min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="flex w-full h-full mb-[200px]">
<UserNavContainer selected={'points'} nickname={userInfo?.memberName} profile={userInfo?.profile}/>
<UserNavContainer
selected={'points'}
nickname={userInfo?.memberName}
profile={userInfo?.profile}
/>
<div className="flex-grow">
{pointNumber === 0 && <MyPointContainer />}
{pointNumber === 1 && <PointCharge />}
Expand Down
6 changes: 5 additions & 1 deletion src/app/(route)/mypage/userinfo/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export default function MyUserPage() {
<section className="flex flex-col min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="flex w-full h-full mb-[200px]">
<UserNavContainer selected={'user'} nickname={userInfo?.memberName} profile={userInfo?.profile} />
<UserNavContainer
selected={'user'}
nickname={userInfo?.memberName}
profile={userInfo?.profile}
/>
<div className="flex-grow">
<EditUserInfo />
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/app/(route)/mypage/withdraw/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export default function WithDrawPage() {
<section className="flex flex-col min-h-screen relative">
<Header nickname={userInfo?.memberName} profile={userInfo?.profile} />
<div className="flex w-full h-full mb-[200px]">
<UserNavContainer selected={'user'} nickname={userInfo?.memberName} profile={userInfo?.profile}/>
<UserNavContainer
selected={'user'}
nickname={userInfo?.memberName}
profile={userInfo?.profile}
/>
<div className="flex-grow">
<WithDrawContainer />
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/app/api/admin/board/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ export async function GET(request: Request): Promise<NextResponse> {
let accessToken = getCookie(request, 'accessToken')
const { searchParams } = new URL(request.url)
const keyword = searchParams.get('keyword') || ''
const page = searchParams.get('page') || ''
const page = searchParams.get('page') || '0'
const data = await getBoard(accessToken, keyword, page).then((data) => data)
console.log(data, '대쉬보드 요청이에요')

return NextResponse.json(data)
}
1 change: 0 additions & 1 deletion src/app/api/coverLetter-analysis/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export async function POST(request: Request) {
const { searchParams } = new URL(request.url)
const id = searchParams.get('id') || ''


const data = await postAiAnalysis(accessToken, id)

return NextResponse.json(data)
Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverLetter-feedbacks/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export async function POST(request: Request) {
const { searchParams } = new URL(request.url)
const id = searchParams.get('id') || ''


const data = await postAiFeedback(accessToken, id)

return NextResponse.json(data)
Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverLetter/analysSatis/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function PATCH(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const id = searchParams.get('id') || ''


const satisfactionData = await request.json()

Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverLetter/satisfaction/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function PATCH(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const id = searchParams.get('id') || ''


const satisfactionData = await request.json()

Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverletters/feedback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export async function POST(request: Request) {
const { searchParams } = new URL(request.url)
const id = searchParams.get('id') || ''


const data = await postAiFeedback(accessToken, id)

return NextResponse.json(data)
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/coverletters/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function POST(request: Request) {
const content = await request.json()
try {
const data = await postCoverLetter(content, accessToken)

return NextResponse.json(data)
} catch (error) {
throw new Error('Error submitting recruiter data')
Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverletters/satisfaction/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function PATCH(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const id = searchParams.get('id') || ''


const satisfactionData = await request.json()

Expand Down
1 change: 0 additions & 1 deletion src/app/api/coverletters/save/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export async function PATCH(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const id = searchParams.get('id') || ''


const covletData = await request.json()

Expand Down
2 changes: 1 addition & 1 deletion src/app/api/experiences/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function POST(request: Request) {
const content = await request.json()
try {
const data = await postExperience(content, accessToken)

return NextResponse.json(data)
} catch (error) {
throw new Error('Error submitting recruiter data')
Expand Down
1 change: 0 additions & 1 deletion src/app/api/experiences/update/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function PATCH(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const id = searchParams.get('id') || ''


const expData = await request.json()

Expand Down
2 changes: 0 additions & 2 deletions src/app/api/mypage/boardDetail/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ export async function POST(request: Request) {
const id = searchParams.get('id') || ''
const data = await postBoardDetail(accessToken, id)



return NextResponse.json(data)
}
1 change: 0 additions & 1 deletion src/app/api/mypage/myCovlet/delete/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function DELETE(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const coverLetterId = searchParams.get('coverLetterId') || ''


try {
const data = await deleteCov(accessToken, coverLetterId)
Expand Down
1 change: 0 additions & 1 deletion src/app/api/mypage/myCovlet/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function GET(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)
const page = searchParams.get('page') || '0'
const data = await getMyCovlet(accessToken, page).then((data) => data)


return NextResponse.json(data)
}
1 change: 0 additions & 1 deletion src/app/api/mypage/myCovletDetail/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function GET(request: Request): Promise<NextResponse> {
const id = searchParams.get('coverLetterId') || ''
let accessToken = getCookie(request, 'accessToken')
const data = await getMyCovletDetail(accessToken, id).then((data) => data)


return NextResponse.json(data)
}
1 change: 0 additions & 1 deletion src/app/api/mypage/myExp/delete/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export async function DELETE(request: Request): Promise<NextResponse> {
const { searchParams } = new URL(request.url)

const experienceId = searchParams.get('experienceId') || ''


try {
const data = await deleteExp(accessToken, experienceId)
Expand Down
Loading

0 comments on commit eb2286e

Please sign in to comment.