feat: 새 기능 GA4 이벤트 — 창 열기·좋아요·댓글·신고·차단·약관 동의·이야기 글쓰기·히어로 오늘/내일·쇼츠·단풍 지도·내 각·토스 인트로·설치 띠 닫기

This commit is contained in:
minaChoi committed 2026-10-28 11:25:58 +09:00
1 parent 1489030c5f
commit 728b24a0c9
13 files changed
+110 -18

No files matched your search

+6 -1
View File
@@ -2,6 +2,7 @@ import { useState } from 'react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { likePostMutation, unlikePostMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
import type { PostReaction, ResFeed } from '@nalssigak/shared/api/client/types.gen'
import { track } from '../lib/analytics'
export type PinnedKey = 'hero_post' | 'gak_post' | 'foliage_post' | 'events_post' | 'season_post'
@@ -29,7 +30,11 @@ export function usePinnedLike(key: PinnedKey, r?: PostReaction | null) {
;(on ? like : unlike).mutate(
{ path: { post_id: r.post_id } },
{
onSuccess: (res) => (res.result?.success ? patch({ liked: res.liked ?? on, ...(res.like_count != null ? { like_count: res.like_count } : {}) }) : revert()),
onSuccess: (res) => {
if (!res.result?.success) return revert()
patch({ liked: res.liked ?? on, ...(res.like_count != null ? { like_count: res.like_count } : {}) })
if (on) track('like', { content_type: key, item_id: r.post_id })
},
onError: revert,
},
)