-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(client): FCM 연동 및 fcm 토큰 전달 #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const firebaseConfig = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiKey: import.meta.env.VITE_FIREBASE_API_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| appId: import.meta.env.VITE_FIREBASE_APP_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 타이핑 및 런타임 검증 추가로 환경오염/미설정 조기 탐지 현재 값이 +import type { FirebaseOptions } from 'firebase/app';
-export const firebaseConfig = {
+export const firebaseConfig: FirebaseOptions = {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_FIREBASE_APP_ID,
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID,
};
+
+// 선택: 필수 키 누락 시 조기 실패
+const missing = Object.entries(firebaseConfig)
+ .filter(([, v]) => !v)
+ .map(([k]) => k);
+if (missing.length) {
+ // eslint-disable-next-line no-console
+ console.error('Missing Firebase env keys:', missing);
+ throw new Error('Firebase env is not configured properly');
+}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,11 @@ import { usePostSignUp } from '@shared/apis/queries'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const stepProgress = [{ progress: 30 }, { progress: 60 }, { progress: 100 }]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { AlarmsType } from '@constants/alarms'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { normalizeTime } from '@pages/onBoarding/utils/formatRemindTime'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { firebaseConfig } from '../../../../firebase-config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { initializeApp } from 'firebase/app'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getMessaging, getToken } from 'firebase/messaging'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Firebase import 정비 및 상대경로 개선
-import { firebaseConfig } from '../../../../firebase-config';
-import { initializeApp } from 'firebase/app';
-import { getMessaging, getToken } from 'firebase/messaging';
+import { firebaseConfig } from '@/firebase-config'; // 또는 적절한 alias
+import { initializeApp, getApps, getApp } from 'firebase/app';
+import { getMessaging, getToken, isSupported } from 'firebase/messaging';추가로, 상단
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const variants = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slideIn: (direction: number) => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| x: direction > 0 ? 200 : -200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -41,6 +46,39 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // api 구간 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const {mutate:postSignData} = usePostSignUp(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // FCM 구간 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [fcmToken, setFcmToken] = useState<string | null>(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const app = initializeApp(firebaseConfig); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const messaging = getMessaging(app); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 중복 초기화 버그: 렌더마다 initializeApp 호출 컴포넌트 본문에서 - const app = initializeApp(firebaseConfig);
- const messaging = getMessaging(app);
+ const app = (getApps().length ? getApp() : initializeApp(firebaseConfig));
+ const messaging = getMessaging(app);추가로 안정성을 위해 모듈 스코프로 올리는 것도 고려해 주세요: // (컴포넌트 밖 상단)
const app = (getApps().length ? getApp() : initializeApp(firebaseConfig));
const messaging = getMessaging(app);🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const requestFCMToken = async (): Promise<string | null> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const permission = await Notification.requestPermission(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (permission !== 'granted') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alert('알림 권한 허용이 필요합니다!'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const forFcmtoken = await getToken(messaging, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vapidKey: import.meta.env.VITE_FIREBASE_VAPID_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (forFcmtoken) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('FCM 토큰 발급 성공:', forFcmtoken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return forFcmtoken; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alert('토큰 생성 실패. 다시 시도해주세요.'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.error('FCM 토큰 받는 도중 오류:', error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alert('알림 설정 중 오류가 발생했습니다. 다시 시도해주세요.'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+54
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 웹 FCM 필수 가드 누락: 브라우저 지원 체크 + 서비스워커 미등록 상태에서 getToken 호출
const requestFCMToken = async (): Promise<string | null> => {
try {
+ // 0) 브라우저 지원 확인
+ if (!(await isSupported())) {
+ alert('현재 브라우저는 푸시 알림을 지원하지 않습니다.');
+ return null;
+ }
+
+ // 1) 서비스워커 등록
+ const swReg = await navigator.serviceWorker.register('/firebase-messaging-sw.js');
+
const permission = await Notification.requestPermission();
if (permission !== 'granted') {
alert('알림 권한 허용이 필요합니다!');
return null;
}
- const forFcmtoken = await getToken(messaging, {
- vapidKey: import.meta.env.VITE_FIREBASE_VAPID_KEY,
- });
+ const newToken = await getToken(messaging, {
+ vapidKey: import.meta.env.VITE_FIREBASE_VAPID_KEY,
+ serviceWorkerRegistration: swReg,
+ });
- if (forFcmtoken) {
- console.log('FCM 토큰 발급 성공:', forFcmtoken);
- return forFcmtoken;
+ if (newToken) {
+ // console.log는 민감정보 노출 우려. 필요 시 debug 플래그 뒤에서만 출력하세요.
+ return newToken;
} else {
alert('토큰 생성 실패. 다시 시도해주세요.');
return null;
}운영 팁:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const ua = navigator.userAgent.toLowerCase(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (ua.includes('mac os') || ua.includes('iphone') || ua.includes('ipad')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -67,11 +105,18 @@ const MainCard = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [remindTime, setRemindTime] = useState('09:00'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nextStep = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(step) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nextStep = async() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (step === 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 이거 이후에 api 붙일 자리 표시임! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const token = await requestFCMToken(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setFcmToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setDirection(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setStep((prev) => prev + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alert('푸시 알람 설정 에러') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (step < 5) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setDirection(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -81,9 +126,9 @@ const [remindTime, setRemindTime] = useState('09:00'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setRemindTime(normalizeTime(raw)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| postSignData({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "email": "tesdfdfsst@gmail.com", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "email": "tesdfdfsst@gmail.com", // TODO : 익스텐션에게서 메일 받기 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "remindDefault": remindTime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fcmToken": "adlfdjlajlkadfsjlkfdsdfsdfsdfsdfsa" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fcmToken": fcmToken, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onSuccess:()=>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,9 +29,9 @@ export const getAcorns = async () => { | |||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export interface postSignUpRequest { | ||||||||||||||||||||||||||||
| email: string; | ||||||||||||||||||||||||||||
| remindDefault: string; | ||||||||||||||||||||||||||||
| fcmToken: string; | ||||||||||||||||||||||||||||
| email: string, | ||||||||||||||||||||||||||||
| remindDefault: string, | ||||||||||||||||||||||||||||
| fcmToken: string | null | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
Comment on lines
31
to
35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainfcmToken: null 전송 대신 “필드 생략(옵셔널)” 권장 — 백엔드 계약 확인 필요
-export interface postSignUpRequest {
+export interface postSignUpRequest {
email: string,
remindDefault: string,
- fcmToken: string | null
+ fcmToken?: string
}추가 권장: 실제 전송 직전에 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
echo
echo "=== Show file apps/client/src/shared/apis/axios.ts (if exists) ==="
if [ -f apps/client/src/shared/apis/axios.ts ]; then
sed -n '1,240p' apps/client/src/shared/apis/axios.ts || true
else
echo "NOT FOUND: apps/client/src/shared/apis/axios.ts"
fi
echo
echo "=== rg: postSignUpRequest ==="
rg -n --hidden -S "postSignUpRequest" -g '!.git' -g '!**/node_modules/**' -C3 || true
echo
echo "=== rg: fcmToken ==="
rg -n --hidden -S "fcmToken" -g '!.git' -g '!**/node_modules/**' -C3 || true
echo
echo "=== rg: signup/register endpoints / function names ==="
rg -n --hidden -S "signup|signUp|register/step|registerUser|register" -g '!.git' -g '!**/node_modules/**' -C3 || true
echo
echo "=== rg: axios.post / axios.create usage ==="
rg -n --hidden -S "axios\.post|axios\.create|axios\(" -g '!.git' -g '!**/node_modules/**' -C3 || true
echo
echo "=== rg: JSON.stringify / transformRequest / replacer ==="
rg -n --hidden -S "JSON.stringify|transformRequest|replacer|serialize" -g '!.git' -g '!**/node_modules/**' -C3 || true
echo
echo "=== rg: possible backend DTOs mentioning fcmToken or signup DTOs ==="
rg -n --hidden -S "fcmToken|FCM|SignUpDto|SignUpDTO|SignupRequest|SignUpRequest|SignUpDto" -g '!.git' -g '!**/node_modules/**' -C3 || trueLength of output: 2722 추가 확인을 위해 아래 스크립트를 실행하겠습니다. 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
echo
echo "=== apps/client/src/shared/apis/axios.ts (existing) ==="
if [ -f apps/client/src/shared/apis/axios.ts ]; then
sed -n '1,240p' apps/client/src/shared/apis/axios.ts || true
else
echo "NOT FOUND: apps/client/src/shared/apis/axios.ts"
fi
echo
echo "=== Find any axiosInstance files ==="
find . -type f \( -iname "*axiosinstance*.ts" -o -iname "*axiosinstance*.js" -o -iname "*axiosinstance*.tsx" -o -iname "*axiosinstance*.jsx" \) -print || true
echo
echo "=== Show first axiosInstance file content (if found) ==="
file=$(find . -type f \( -iname "*axiosinstance*.ts" -o -iname "*axiosinstance*.js" -o -iname "*axiosinstance*.tsx" -o -iname "*axiosinstance*.jsx" \) | head -n1 || true)
if [ -n "$file" ]; then
echo "FOUND: $file"
sed -n '1,240p' "$file" || true
else
echo "No axiosInstance file found"
fi
echo
echo "=== Search for postSignUp call sites ==="
rg -n --hidden -S "postSignUp\\(" || true
echo
echo "=== Search for direct '/api/v1/auth/signup' usages ==="
rg -n --hidden -S "/api/v1/auth/signup" || true
echo
echo "=== Search for fcmToken usages across repo ==="
rg -n --hidden -S "fcmToken" || true
echo
echo "=== Search for where signup payload / types are referenced ==="
rg -n --hidden -S "postSignUpRequest|responsedata" || true
echo
echo "=== Show package.json files (root and apps/client) ==="
if [ -f package.json ]; then
echo "--- root package.json ---"
sed -n '1,240p' package.json || true
fi
if [ -f apps/client/package.json ]; then
echo "--- apps/client/package.json ---"
sed -n '1,240p' apps/client/package.json || true
fiLength of output: 8589 fcmToken을 null로 전송하지 말고 필드를 생략하세요 — 백엔드 DTO(가입 API) 허용 여부 확인 필요 현재 postSignUp에 전달되는 객체가 fcmToken === null이면 요청 바디에 "fcmToken": null이 포함됩니다. 백엔드가 null을 허용하지 않으면 400을 일으킬 수 있으므로 인터페이스를 옵셔널로 변경하고 전송 시 null인 경우 필드를 제외하세요. 위치: apps/client/src/shared/apis/axios.ts (postSignUpRequest), apps/client/src/pages/onBoarding/components/funnel/MainCard.tsx (fcmToken 상태 및 전송) -export interface postSignUpRequest {
+export interface postSignUpRequest {
email: string,
remindDefault: string,
- fcmToken: string | null
+ fcmToken?: string
}전송 구현 힌트: payload 생성 시 ...(fcmToken ? { fcmToken } : {}) 처럼 조건부 포함하거나 fcmToken을 undefined로 두고 JSON.stringify가 undefined 필드를 제거하는지 확인하세요. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export const postSignUp = async (responsedata: postSignUpRequest) => { | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
FCM 동작을 위해 서비스 워커와 환경변수 점검 필요
firebase 의존성 추가만으로는 웹 FCM이 동작하지 않습니다.
public/firebase-messaging-sw.js존재 여부와 VAPID/프로젝트 env 설정을 꼭 확인해 주세요.다음 스크립트로 빠르게 점검 가능합니다:
🏁 Script executed:
Length of output: 790
public/firebase-messaging-sw.js 없음 — 서비스 워커 추가/등록 필요
🤖 Prompt for AI Agents