parent
005c66c60a
commit
6866dae012
5 changed files with 22 additions and 66 deletions
@ -1,42 +0,0 @@ |
|||||||
--- |
|
||||||
import { userApi } from '../../../../api/user'; |
|
||||||
import AccountLayout from '../../../../layouts/AccountLayout.astro'; |
|
||||||
import { UserProfileRoadmap } from '../../../../components/UserPublicProfile/UserProfileRoadmap'; |
|
||||||
|
|
||||||
interface Params extends Record<string, string | undefined> { |
|
||||||
username: string; |
|
||||||
roadmapId: string; |
|
||||||
} |
|
||||||
|
|
||||||
const { username, roadmapId } = Astro.params as Params; |
|
||||||
if (!username) { |
|
||||||
return Astro.redirect('/404'); |
|
||||||
} |
|
||||||
|
|
||||||
const userClient = userApi(Astro as any); |
|
||||||
const { response: userDetails, error } = |
|
||||||
await userClient.getPublicProfile(username); |
|
||||||
|
|
||||||
if (error || !userDetails) { |
|
||||||
return Astro.redirect('/404'); |
|
||||||
} |
|
||||||
|
|
||||||
const { response: roadmapDetails, error: progressError } = |
|
||||||
await userClient.getUserProfileRoadmap(username, roadmapId); |
|
||||||
|
|
||||||
if (progressError || !roadmapDetails) { |
|
||||||
return Astro.redirect('/404'); |
|
||||||
} |
|
||||||
--- |
|
||||||
|
|
||||||
<AccountLayout title={`${roadmapDetails?.title} | ${userDetails?.name}`}> |
|
||||||
<UserProfileRoadmap |
|
||||||
{...roadmapDetails} |
|
||||||
username={username} |
|
||||||
name={userDetails?.name} |
|
||||||
resourceId={roadmapId} |
|
||||||
isOwnProfile={userDetails?.isOwnProfile} |
|
||||||
profileVisibility={userDetails?.profileVisibility} |
|
||||||
client:load |
|
||||||
/> |
|
||||||
</AccountLayout> |
|
Loading…
Reference in new issue