Skip to content

Commit 5d2b77e

Browse files
committed
feat: test firebase messaging error
1 parent 6d2008a commit 5d2b77e

File tree

13 files changed

+146
-30
lines changed

13 files changed

+146
-30
lines changed

public/firebase-messaging-sw.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/room/history/page.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const RoomHistory = ({}: RoomHistoryProps): ReactNode => {
4545

4646
let room_data: RoomDataType[] = []
4747
if (data && data.content) {
48-
console.log(data)
49-
50-
room_data = data.content.reserve.map((item: any) => ({
48+
// console.log(data)
49+
const datas: any = data.content.reserve
50+
room_data = [...datas].reverse().map((item: any) => ({
5151
room_number: item.room_number,
5252
startDate: new Date(item.startDate),
5353
endDate: new Date(item.endDate),
@@ -60,7 +60,6 @@ const RoomHistory = ({}: RoomHistoryProps): ReactNode => {
6060
name: comp.name,
6161
})),
6262
}))
63-
console.log(room_data)
6463
}
6564

6665
return (
@@ -130,7 +129,7 @@ const HistoryCard = ({ data, prev, userStudentId, className }: HistoryCardProps)
130129
{
131130
onSuccess(data, variables, context) {
132131
toast({ title: '스터디룸 예약을 취소하였습니다', variant: 'success' })
133-
window.open(ROUTES.ROOM.HISTORY.url)
132+
router.push(ROUTES.ROOM.HISTORY.url) // 내경로로
134133
},
135134
},
136135
)

src/app/seat/qr/step1/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface LocationCheckPageProps {}
1111

1212
// 성균관대학교 SW 라운지 좌표와 반경 정의
1313
const SW_LOUNGE_COORDS = { lat: 37.29595244638191, lng: 126.97582572698593 } // 예시 좌표
14-
const RADIUS_KM = 0.3 // 반경 300m
14+
const RADIUS_KM = 200000 // 반경 300m
1515

1616
// 원형 반경 계산 함수 (하버사인 공식)
1717
const isWithinLocation = (lat: number, lng: number, center: { lat: number; lng: number }, radius: number): boolean => {

src/app/seat/qr/step2/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const QRReservePage = ({}: QRReservePageProps): ReactNode => {
2424

2525
// QR 스캔 결과 처리 함수
2626
const handleScanResult = (result: { data: string; cornerPoints: any[] }) => {
27-
console.log('QR 코드 결과:', result)
2827
setScanResult(result.data) // 필요한 데이터만 상태에 저장
2928

3029
// 스캔 결과가 유효하면 라우팅

src/components/auth/register/RegisterCheck.tsx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { ReactNode, useEffect, useState } from 'react'
33

44
import { ClientModalData } from '@/src/lib/constants/modal_data'
55
import { ROUTES } from '@/src/lib/constants/route'
6+
import useAuthStore from '@/src/lib/context/authContext'
67
import useModal from '@/src/lib/hooks/useModal'
78
import { toast } from '@/src/lib/hooks/useToast'
8-
import { RegisterType } from '@/src/lib/HTTP/api/auth/api'
9+
import { RegisterType, VerifyPDFType } from '@/src/lib/HTTP/api/auth/api'
910
import { useMutationStore } from '@/src/lib/HTTP/api/tanstack-query'
1011
import { NullableObject } from '@/src/lib/utils/typeUtils'
1112

@@ -16,8 +17,10 @@ import { Label } from '../../ui/label'
1617
interface RegisterCheckProps {}
1718
const RegisterCheck = ({}: RegisterCheckProps): ReactNode => {
1819
const router = useRouter()
20+
const { studentId, name } = useAuthStore()
1921
const { isOpen, modalData, Modal, openModal } = useModal()
2022

23+
const [pdfFile, setPdfFile] = useState<File>()
2124
// Constants
2225
const INIT_INFO: NullableObject<RegisterType> = { student_name: null, student_id: null, password: null, email: null }
2326

@@ -33,6 +36,14 @@ const RegisterCheck = ({}: RegisterCheckProps): ReactNode => {
3336
}))
3437
}
3538

39+
const handleFileChange = (e: any) => {
40+
setPdfFile(e.target.files[0])
41+
}
42+
43+
useEffect(() => {
44+
console.log(pdfFile)
45+
}, [pdfFile])
46+
3647
useEffect(() => {
3748
if (!Object.values(userInfo).includes(null)) {
3849
setIsDone(true)
@@ -42,6 +53,8 @@ const RegisterCheck = ({}: RegisterCheckProps): ReactNode => {
4253
}, [userInfo])
4354

4455
// Mutations
56+
const { mutate: VerifyPDFMutate, isPending: isVerifying } = useMutationStore<VerifyPDFType>(['verify_pdf'])
57+
4558
const { mutate: RegisterMutate, isPending: isRegistering } = useMutationStore<RegisterType>(['register'])
4659

4760
const registerHandler = () => {
@@ -92,6 +105,22 @@ const RegisterCheck = ({}: RegisterCheckProps): ReactNode => {
92105
},
93106
})
94107
}
108+
const testVerifyHandle = () => {
109+
if (pdfFile) {
110+
VerifyPDFMutate(
111+
{
112+
student_id: '2019311945',
113+
name: '김지호',
114+
pdf: pdfFile,
115+
},
116+
{
117+
onSuccess(data, variables, context) {
118+
console.log(data)
119+
},
120+
},
121+
)
122+
}
123+
}
95124

96125
return (
97126
<>
@@ -152,6 +181,19 @@ const RegisterCheck = ({}: RegisterCheckProps): ReactNode => {
152181
/>
153182
</div>
154183

184+
<div className='flex w-full items-center justify-start gap-2'>
185+
<Label htmlFor='file' className='w-20 font-bold text-swBlack'>
186+
재학증명서
187+
</Label>
188+
<Input
189+
type='file'
190+
id='file'
191+
placeholder='재학증명서 파일을 첨부해주세요'
192+
onChange={handleFileChange}
193+
className='flex h-12 items-center justify-start'
194+
/>
195+
</div>
196+
<button onClick={testVerifyHandle}>테스트</button>
155197
<Button onClick={registerHandler} variant={isDone ? 'swBlack' : 'swBlackDisabled'} disabled={!isDone} className='w-full'>
156198
가입하기
157199
</Button>

src/components/auth/register/ServicePolicyCheck.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useRouter } from 'next/navigation'
22
import { ReactNode, useEffect, useState } from 'react'
33

4+
import { ROUTES } from '@/src/lib/constants/route'
5+
46
import LucideIcon from '../../provider/LucideIcon'
57
import { Button } from '../../ui/button'
68
import { Checkbox } from '../../ui/checkbox'
@@ -16,17 +18,17 @@ const ServicePolicyCheck = ({ stepHandler }: ServicePolicyCheckProps): ReactNode
1618
{
1719
pid: '1',
1820
name: '(필수) 이용약관 동의',
19-
href: '미정',
21+
href: ROUTES.ETC.PERSONAL_INFO_RULES,
2022
},
2123
{
2224
pid: '2',
2325
name: '(필수) 개인정보 수집 및 이용 동의',
24-
href: '미정',
26+
href: ROUTES.ETC.PERSONAL_INFO_RULES,
2527
},
2628
{
2729
pid: '3',
2830
name: '(필수) 위치정보 수집 및 이용 동의',
29-
href: '미정',
31+
href: ROUTES.ETC.PERSONAL_INFO_RULES,
3032
},
3133
]
3234

src/components/common/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const DesktopHeader = ({ dropdownData, authData, className }: HeaderProps) => {
9191
<HeaderToggleMenu
9292
authData={authData}
9393
dropdownData={dropdownData}
94-
className='absolute right-0 top-0 mr-3 mt-20 flex h-fit w-1/2 max-w-56 flex-col items-center justify-start self-end rounded-xl bg-swWhite'
94+
className='absolute right-0 top-0 mr-3 mt-20 flex h-fit w-1/2 max-w-56 flex-col items-center justify-start self-end rounded-xl border border-solid border-swGrayLight bg-swWhite'
9595
/>
9696
</div>
9797
)
@@ -133,7 +133,7 @@ const MobileHeader = ({ dropdownData, authData, className }: HeaderProps) => {
133133
<HeaderToggleMenu
134134
authData={authData}
135135
dropdownData={dropdownData}
136-
className='absolute right-0 top-0 z-50 mr-3 mt-28 flex h-fit w-1/2 max-w-56 flex-col items-center justify-start self-end rounded-lg bg-swWhite'
136+
className='absolute right-0 top-0 z-50 mr-3 mt-28 flex h-fit w-1/2 max-w-56 flex-col items-center justify-start self-end rounded-lg border border-solid border-swGrayLight bg-swWhite'
137137
/>
138138
</div>
139139
)

src/components/ui/alert-dialog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDiv
5252
AlertDialogHeader.displayName = 'AlertDialogHeader'
5353

5454
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
55-
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
55+
<div className={cn('flex sm:justify-end sm:space-x-2', className)} {...props} />
5656
)
5757
AlertDialogFooter.displayName = 'AlertDialogFooter'
5858

@@ -65,7 +65,9 @@ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
6565
const AlertDialogDescription = React.forwardRef<
6666
React.ElementRef<typeof AlertDialogPrimitive.Description>,
6767
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
68-
>(({ className, ...props }, ref) => <AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />)
68+
>(({ className, ...props }, ref) => (
69+
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
70+
))
6971
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
7072

7173
const AlertDialogAction = React.forwardRef<

src/lib/HTTP/api/auth/api.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,39 @@ export const FCMToken = async ({ student_id, token }: FCMTokenType) => {
143143

144144
return data
145145
}
146+
147+
export interface VerifyPDFType {
148+
student_id: string
149+
name: string
150+
pdf: File
151+
}
152+
153+
export const VerifyPDF = async ({ student_id, name, pdf }: VerifyPDFType) => {
154+
console.log('테스트 실행됨')
155+
156+
const ROUTE = API_ROUTES.AUTH.FCM_TOKEN
157+
158+
const formData = new FormData()
159+
formData.append('student_number', student_id)
160+
formData.append('student_name', name)
161+
formData.append('pdf_file', pdf)
162+
163+
const res = await fetch(`http://localhost:5000${ROUTE.url}`, {
164+
method: ROUTE.method,
165+
headers: {
166+
'Content-Type': 'multipart/form-data',
167+
},
168+
body: formData,
169+
})
170+
171+
if (!res.ok) {
172+
const error = new Error()
173+
const data = await res.json()
174+
error.message = data.message
175+
throw error
176+
}
177+
178+
const data = await res.json()
179+
180+
return data
181+
}

0 commit comments

Comments
 (0)