Skip to content

Commit a3b6cc0

Browse files
committed
fix(ui): fix useRoute argument, useFetch types, and null safety
1 parent b5bf1f2 commit a3b6cc0

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

app/pages/profile/[handle]/index.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<script setup lang="ts">
22
import { updateProfile as updateProfileUtil } from '~/utils/atproto/profile'
33
4-
const route = useRoute('/profile/[handle]')
4+
const route = useRoute('profile-handle')
55
const handle = computed(() => route.params.handle)
66
7-
const { data: profile }: { data?: NPMXProfile } = useFetch(
8-
() => `/api/social/profile/${handle.value}`,
9-
{
10-
default: () => ({ profile: { displayName: handle.value } }),
11-
server: false,
12-
},
13-
)
7+
const { data: profile } = useFetch<NPMXProfile>(() => `/api/social/profile/${handle.value}`, {
8+
default: () => ({ displayName: handle.value, description: '', website: '' }),
9+
server: false,
10+
})
1411
1512
const { user } = useAtproto()
1613
const isEditing = ref(false)
@@ -30,7 +27,7 @@ watchEffect(() => {
3027
})
3128
3229
async function updateProfile() {
33-
if (!user.value.handle || !displayNameInput.value) {
30+
if (!user.value?.handle || !displayNameInput.value) {
3431
return
3532
}
3633

0 commit comments

Comments
 (0)