Skip to content

Commit 09eae80

Browse files
committed
feat: compatible profile query by username
Signed-off-by: Innei <i@innei.in>
1 parent b57f43f commit 09eae80

File tree

1 file changed

+3
-3
lines changed
  • apps/renderer/src/pages/(external)/(with-layout)/profile/[id]

1 file changed

+3
-3
lines changed

apps/renderer/src/pages/(external)/(with-layout)/profile/[id]/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ import { usePresentFeedFormModal } from "~/hooks/biz/useFeedFormModal"
1212
import { useAuthQuery, useI18n, useTitle } from "~/hooks/common"
1313
import { apiClient } from "~/lib/api-fetch"
1414
import { defineQuery } from "~/lib/defineQuery"
15-
import { cn } from "~/lib/utils"
15+
import { cn, isBizId } from "~/lib/utils"
1616
import { useUserSubscriptionsQuery } from "~/modules/profile/hooks"
1717

1818
export function Component() {
1919
const t = useI18n()
2020
const { id } = useParams()
2121

22-
const isHandle = id?.startsWith("@")
22+
const isHandle = id ? id.startsWith("@") || !isBizId(id) : false
2323
const user = useAuthQuery(
2424
defineQuery(["profiles", id], async () => {
2525
const res = await apiClient.profiles.$get({
2626
query: {
27-
handle: isHandle ? id?.slice(1) : undefined,
27+
handle: isHandle ? (id?.startsWith("@") ? id.slice(1) : id) : undefined,
2828
id: isHandle ? undefined : id,
2929
},
3030
})

0 commit comments

Comments
 (0)