[FE] FIX: 모바일로 접속시 발생되는 firebase error 해결 #1680 #1685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
해당 사항 (중복 선택)
설명
문제1
api_response_delay.mov
api_calls_on_save_click.mov
내 정보 - 알림
에서 가끔 알림 설정 변경시 브라우저 알림 권한 요청 보낸 후 응답 수신까지 2~3초 정도 소요.응답 받기 전까지
1. 설정이 변경되고 있는건지 아님 클릭이 안된건지 알 수가 없었음.(작업 수행중임을 알려주는 UI 부재)
2. 저장 버튼 클릭할때마다 api 요청 보내짐
문제1 해결
solved.mov
(영상에서 저장버튼 hover시 깨지는데 아래 커서로 바뀌는거에요!)
IButtonProps
에isLoading
추가저장
및취소
버튼에isLoading : true
로 설정 후,isLoading이면
저장
버튼 hover시 cursor 속성값wait
으로,취소
버튼 hover시not-allowed
로 변경문제2
아이폰으로 cabi 홈페이지 접속시(PWA 포함) "
FirebaseError Messaging: This browser doesn't support the API's required to use the Firebase SDK. (messaging/unsupported-browser).
" 에러 발생dev 환경에서 테스트 하고자 했으나 아이폰으로 https://dev.cabi.42seoul.io 접속시 해당 에러가 발생하지 않아 테스트 불가
(왜 dev 환경에선 에러 발생하지 모르겠어요 ㅠ.ㅠ)
문제2 에러 원인으로 추측되는 곳 수정
예상 원인 : getMessaging 함수를 브라우저 환경이 아닐때 호출해서
cf) FCM의 getMessaging : 웹 브라우저나 모바일 애플리케이션에서 푸시 메시지를 수신하는 데 사용
기존 코드
getMessaging
함수가 브라우저 환경이 아닐때도 호출될 수 있다.수정 코드
브라우저 환경에서만
getMessaging
호출 가능하게 변경아래는
requestFcmAndGetDeviceToken
함수에서 브라우저 환경이 아닐때 messaging 사용하는 것을 방지하는 코드인데,console에 출력하는 것 외에 더 좋은 방법 추천 받습니다. 편하게 의견 주세요 !
문제3
중요하지 않은 센트리 알림 수신
문제3 해결
401 bad request는 센트리에 로깅할만한 중요한 에러가 아니라 판단해서
logAxiosError
함수에 401의 경우 센트리 로깅에서 제외하는 코드(⬇️)를 추가했습니다.문제4
axios custom, 파일, 함수 등의 이름에 notification, alarm 혼용으로 인한 혼돈
문제4 해결
Profile과 Admin Slack 부분의 Notification을 Alarm 으로 변경해 백엔드와 통일했습니다.
#1680