11<script setup lang="ts">
22import { updateProfile as updateProfileUtil } from ' ~/utils/atproto/profile'
33
4- const route = useRoute (' profile-handle ' )
5- const handle = computed (() => route .params .handle )
4+ const route = useRoute (' profile-identity ' )
5+ const identity = computed (() => route .params .identity )
66
77const { data : profile, error : profileError } = await useFetch <NPMXProfile >(
8- () => ` /api/social/profile/${handle .value } ` ,
8+ () => ` /api/social/profile/${identity .value } ` ,
99 {
1010 default : () => ({
11- displayName: handle .value ,
11+ displayName: identity .value ,
1212 description: ' ' ,
1313 website: ' ' ,
1414 recordExists: false ,
@@ -19,7 +19,7 @@ if (!profile.value || profileError.value?.statusCode === 404) {
1919 throw createError ({
2020 statusCode: 404 ,
2121 statusMessage: $t (' profile.not_found' ),
22- message: $t (' profile.not_found_message' , { handle: handle .value }),
22+ message: $t (' profile.not_found_message' , { handle: identity .value }),
2323 })
2424}
2525
@@ -53,11 +53,12 @@ async function updateProfile() {
5353 displayName: displayNameInput .value ,
5454 description: descriptionInput .value || undefined ,
5555 website: websiteInput .value || undefined ,
56+ handle: profile .value .handle ,
5657 recordExists: true ,
5758 }
5859
5960 try {
60- const result = await updateProfileUtil (handle .value , {
61+ const result = await updateProfileUtil (identity .value , {
6162 displayName: displayNameInput .value ,
6263 description: descriptionInput .value || undefined ,
6364 website: websiteInput .value || undefined ,
@@ -76,25 +77,25 @@ async function updateProfile() {
7677 }
7778}
7879
79- const { data : likes, status } = useProfileLikes (handle )
80+ const { data : likes, status } = useProfileLikes (identity )
8081
8182const showInviteSection = computed (() => {
8283 return (
8384 profile .value .recordExists === false &&
8485 status .value === ' success' &&
8586 ! likes .value ?.records ?.length &&
86- user .value ?.handle !== handle .value
87+ user .value ?.handle !== profile .value . handle
8788 )
8889})
8990
9091const inviteUrl = computed (() => {
91- const text = $t (' profile.invite.compose_text' , { handle: handle .value })
92+ const text = $t (' profile.invite.compose_text' , { handle: profile .value . handle })
9293 return ` https://bsky.app/intent/compose?text=${encodeURIComponent (text )} `
9394})
9495
9596useSeoMeta ({
96- title : () => $t (' profile.seo_title' , { handle: handle .value }),
97- description : () => $t (' profile.seo_description' , { handle: handle .value }),
97+ title : () => $t (' profile.seo_title' , { handle: identity .value }),
98+ description : () => $t (' profile.seo_description' , { handle: identity .value }),
9899})
99100
100101/**
@@ -143,7 +144,7 @@ defineOgImageComponent('Default', {
143144 />
144145 </label >
145146 <div class =" flex gap-4 items-center font-mono text-sm" >
146- <h2 >@{{ handle }}</h2 >
147+ <h2 >@{{ profile?. handle }}</h2 >
147148 <ButtonBase @click =" isEditing = false" >
148149 {{ $t('common.cancel') }}
149150 </ButtonBase >
@@ -164,13 +165,13 @@ defineOgImageComponent('Default', {
164165 </h1 >
165166 <p v-if =" profile.description" >{{ profile.description }}</p >
166167 <div class =" flex gap-4 items-center font-mono text-sm" >
167- <h2 >@{{ handle }}</h2 >
168+ <h2 >@{{ profile. handle ?? identity }}</h2 >
168169 <LinkBase v-if =" profile.website" :to =" profile.website" classicon =" i-lucide:link" >
169170 {{ profile.website }}
170171 </LinkBase >
171172 <ButtonBase
172173 @click =" isEditing = true"
173- :class =" user?.handle === handle ? '' : 'invisible'"
174+ :class =" user?.handle === profile?. handle ? '' : 'invisible'"
174175 class =" hidden sm:inline-flex"
175176 >
176177 {{ $t('common.edit') }}
0 commit comments