Skip to content

Commit

Permalink
feat: conditional word refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
createhb21 committed Aug 5, 2024
1 parent 4760094 commit 2ccb55d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hooks/fcm/mutaion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const usePushServiceInitialize = ({ uid }: { uid?: string }) => {
useEffect(() => {
if (isWebView()) {
const deviceInfoMessageListener = ({ data }: MessageEvent) => {
const deviceInfos: DeviceInfo = data ? JSON.parse(data) : {};
const isAccurateData = typeof data && data === "string" && data.includes("deviceInfo");
const deviceInfos: DeviceInfo = isAccurateData ? JSON.parse(data) : {};
const shouldRegisterListener = !isNil(uid) && !isEmpty(deviceInfos);

if (shouldRegisterListener) {
Expand Down

0 comments on commit 2ccb55d

Please sign in to comment.