File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
app/pages/package/[[org]] Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -405,10 +405,16 @@ const { user } = useAtproto()
405405
406406const authModal = useModal (' auth-modal' )
407407
408- const { data : likesData } = useFetch (() => ` /api/social/likes/${packageName .value } ` , {
409- default : () => ({ totalLikes: 0 , userHasLiked: false }),
410- server: false ,
411- })
408+ const { data : likesData, status : likeStatus } = useFetch (
409+ () => ` /api/social/likes/${packageName .value } ` ,
410+ {
411+ default : () => ({ totalLikes: 0 , userHasLiked: false }),
412+ server: false ,
413+ },
414+ )
415+ const isLoadingLikeData = computed (
416+ () => likeStatus .value !== ' error' && likeStatus .value !== ' success' ,
417+ )
412418
413419const isLikeActionPending = ref (false )
414420
@@ -614,11 +620,22 @@ onKeyStroke(
614620 <!-- Package likes -->
615621 <TooltipApp
616622 :text ="
617- likesData?.userHasLiked ? $t('package.likes.unlike') : $t('package.likes.like')
623+ isLoadingLikeData
624+ ? $t('common.loading')
625+ : likesData?.userHasLiked
626+ ? $t('package.likes.unlike')
627+ : $t('package.likes.like')
618628 "
619629 position =" bottom"
630+ class =" items-center"
620631 >
632+ <span
633+ v-if =" isLoadingLikeData"
634+ class =" i-carbon-circle-dash w-3 h-3 motion-safe:animate-spin"
635+ aria-hidden =" true"
636+ />
621637 <button
638+ v-else
622639 @click =" likeAction"
623640 type =" button"
624641 :title ="
You can’t perform that action at this time.
0 commit comments