-
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.
Merge branch 'develop' into feature/application
- Loading branch information
Showing
65 changed files
with
1,397 additions
and
345 deletions.
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,12 +1,12 @@ | ||
import React from 'react'; | ||
import Header from '@/widgets/layout/ui/Header'; | ||
import { Admin } from '@/views/admin'; | ||
|
||
const admin = () => { | ||
const page = () => { | ||
return ( | ||
<div> | ||
<Header /> | ||
<Admin /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default admin; | ||
export default page; |
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,40 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function PATCH( | ||
request: NextRequest, | ||
{ params }: { params: { admin_id: number } }, | ||
) { | ||
const { admin_id } = params; | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
console.log(admin_id); | ||
console.log(accessToken); | ||
|
||
try { | ||
const response = await apiClient.patch( | ||
`/admin/${admin_id}`, | ||
{}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}, | ||
); | ||
|
||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
if (error instanceof AxiosError) { | ||
const status = error.response?.status; | ||
const message = error.response?.data?.message || 'Unknown error'; | ||
return NextResponse.json({ error: message }, { status: status || 500 }); | ||
} else { | ||
return NextResponse.json( | ||
{ error: 'Internal Server Error' }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} | ||
} |
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,26 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function GET() { | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
|
||
try { | ||
const response = await apiClient.get('/admin', { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
const axiosError = error as AxiosError<{ message: string }>; | ||
|
||
const status = axiosError.response?.status || 500; | ||
const message = | ||
axiosError.response?.data?.message || 'request signup failed'; | ||
|
||
return NextResponse.json({ error: message }, { status }); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function POST(request: Request) { | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
|
||
try { | ||
const formData = await request.formData(); | ||
const response = await apiClient.post('/image', formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
const axiosError = error as AxiosError<{ message: string }>; | ||
|
||
const status = axiosError.response?.status || 500; | ||
const message = axiosError.response?.data?.message || 'image upload failed'; | ||
|
||
return NextResponse.json({ error: message }, { status }); | ||
} | ||
} |
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,34 @@ | ||
import axios from 'axios'; | ||
import { NextResponse } from 'next/server'; | ||
|
||
const KAKAO_REST_API_KEY = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY; | ||
|
||
export async function GET(request: Request) { | ||
const { searchParams } = new URL(request.url); | ||
const address = searchParams.get('address'); | ||
|
||
if (!address) { | ||
return NextResponse.json( | ||
{ error: 'Address parameter is required' }, | ||
{ status: 400 }, | ||
); | ||
} | ||
|
||
const url = `https://dapi.kakao.com/v2/local/search/address.json?query=${encodeURIComponent(address)}`; | ||
|
||
try { | ||
const response = await axios.get(url, { | ||
headers: { | ||
Authorization: `KakaoAK ${KAKAO_REST_API_KEY}`, | ||
}, | ||
}); | ||
|
||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
console.error('Error fetching address data:', error); | ||
return NextResponse.json( | ||
{ error: 'Failed to fetch address data' }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} |
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,37 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function POST( | ||
request: NextRequest, | ||
{ params }: { params: { expo_id: number } }, | ||
) { | ||
const body = await request.json(); | ||
const { expo_id } = params; | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
console.log(expo_id); | ||
console.log(accessToken); | ||
|
||
try { | ||
const response = await apiClient.post(`/standard/list/${expo_id}`, body, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
|
||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
if (error instanceof AxiosError) { | ||
const status = error.response?.status; | ||
const message = error.response?.data?.message || 'Unknown error'; | ||
return NextResponse.json({ error: message }, { status: status || 500 }); | ||
} else { | ||
return NextResponse.json( | ||
{ error: 'Internal Server Error' }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} | ||
} |
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,26 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function GET( | ||
request: NextRequest, | ||
{ params }: { params: { expo_id: number } }, | ||
) { | ||
const { expo_id } = params; | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
try { | ||
const response = await apiClient.get(`/standard/program/${expo_id}`, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
const axiosError = error as AxiosError<{ message: string }>; | ||
const status = axiosError.response?.status || 500; | ||
const message = axiosError.response?.data?.message || 'expoDetail failed'; | ||
return NextResponse.json({ error: message }, { status }); | ||
} | ||
} |
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,37 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function POST( | ||
request: NextRequest, | ||
{ params }: { params: { expo_id: number } }, | ||
) { | ||
const body = await request.json(); | ||
const { expo_id } = params; | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
console.log(expo_id); | ||
console.log(accessToken); | ||
|
||
try { | ||
const response = await apiClient.post(`/training/list/${expo_id}`, body, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
|
||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
if (error instanceof AxiosError) { | ||
const status = error.response?.status; | ||
const message = error.response?.data?.message || 'Unknown error'; | ||
return NextResponse.json({ error: message }, { status: status || 500 }); | ||
} else { | ||
return NextResponse.json( | ||
{ error: 'Internal Server Error' }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} | ||
} |
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,26 @@ | ||
import { AxiosError } from 'axios'; | ||
import { cookies } from 'next/headers'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { apiClient } from '@/shared/libs/apiClient'; | ||
|
||
export async function GET( | ||
request: NextRequest, | ||
{ params }: { params: { expo_id: number } }, | ||
) { | ||
const { expo_id } = params; | ||
const cookieStore = cookies(); | ||
const accessToken = cookieStore.get('accessToken')?.value; | ||
try { | ||
const response = await apiClient.get(`/training/program/${expo_id}`, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
return NextResponse.json(response.data); | ||
} catch (error) { | ||
const axiosError = error as AxiosError<{ message: string }>; | ||
const status = axiosError.response?.status || 500; | ||
const message = axiosError.response?.data?.message || 'expoDetail failed'; | ||
return NextResponse.json({ error: message }, { status }); | ||
} | ||
} |
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 @@ | ||
export { default as AdminProfile } from './ui/AdminProfile'; |
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,29 @@ | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
import { Setting } from '@/shared/assets/icons'; | ||
import Profile from '@/shared/assets/png/Profile.png'; | ||
|
||
const ProfileInfo = ({ label, value }: { label: string; value: string }) => ( | ||
<div className="flex gap-[30px]"> | ||
<p className="w-fit text-body2 text-gray-500">{label}</p> | ||
<p className="w-fit text-body2 text-black">{value}</p> | ||
</div> | ||
); | ||
|
||
const AdminProfile = () => { | ||
return ( | ||
<div className="mx-auto my-0 flex w-fit"> | ||
<div className="flex items-center gap-[124px] mobile:flex-col mobile:gap-[30px]"> | ||
<Image src={Profile} alt="관리자 프로필" /> | ||
<div className="space-y-[32px]"> | ||
<ProfileInfo label="이름" value="김진원" /> | ||
<ProfileInfo label="아이디" value="jin1234" /> | ||
<ProfileInfo label="이메일" value="jin12345@gmail.com" /> | ||
</div> | ||
</div> | ||
<Setting /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AdminProfile; |
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,3 @@ | ||
export { default as ExpoInput } from './ui/ExpoInput'; | ||
export { default as ImageInput } from './ui/ImageInput'; | ||
export { default as TrainingModule } from './ui/TrainingModule'; | ||
export { default as SearchAddress } from './ui/SearchAddress'; |
Oops, something went wrong.